Conversation
uninitialized from allockind when creating dummy zeroed variant functionuninitialized from allockind when creating dummy zeroed variant function
Member
|
@llvm/pr-subscribers-llvm-transforms Author: None (clubby789) Changescc #138299 rustc sets Full diff: https://github.com/llvm/llvm-project/pull/149336.diff 2 Files Affected:
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 85dd9a1bf7161..0f63ed0166cf4 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -2079,6 +2079,7 @@ struct DSEState {
AllocFnKind AllocKind =
Attrs.getFnAttr(Attribute::AllocKind).getAllocKind() |
AllocFnKind::Zeroed;
+ AllocKind &= ~AllocFnKind::Uninitialized;
Attrs =
Attrs.addFnAttribute(Ctx, Attribute::getWithAllocKind(Ctx, AllocKind))
.removeFnAttribute(Ctx, "alloc-variant-zeroed");
diff --git a/llvm/test/Transforms/DeadStoreElimination/zeroed-missing.ll b/llvm/test/Transforms/DeadStoreElimination/zeroed-missing.ll
index e390d4bdca632..303afc207c023 100644
--- a/llvm/test/Transforms/DeadStoreElimination/zeroed-missing.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/zeroed-missing.ll
@@ -12,6 +12,6 @@ define ptr @undeclared_customalloc(i64 %size, i64 %align) {
ret ptr %call
}
-declare ptr @customalloc2(i64, i64) allockind("alloc") "alloc-family"="customalloc2" "alloc-variant-zeroed"="customalloc2_zeroed"
+declare ptr @customalloc2(i64, i64) allockind("alloc,uninitialized") "alloc-family"="customalloc2" "alloc-variant-zeroed"="customalloc2_zeroed"
; CHECK-DAG: declare ptr @customalloc2_zeroed(i64, i64) #[[CA2ATTR:[0-9]+]]
; CHECK-DAG: attributes #[[CA2ATTR]] = { allockind("alloc,zeroed") "alloc-family"="customalloc2" }
|
Contributor
|
/cherry-pick 74c396a |
Member
|
/pull-request #149468 |
tru
pushed a commit
to llvmbot/llvm-project
that referenced
this pull request
Jul 22, 2025
…oed variant function (llvm#149336) cc llvm#138299 rustc sets `allockind("uninitialized")` - if we copy the attributes as-is when creating a dummy function, Verify complains about `allockind("uninitialized,zeroed")` conflicting, so we need to clear the flag. Co-authored-by: Jamie Hill-Daniel <[email protected]> (cherry picked from commit 74c396a)
This was referenced Jul 23, 2025
bors
added a commit
to rust-lang/rust
that referenced
this pull request
Aug 19, 2025
Pass `alloc-variant-zeroed` to LLVM Makes use of llvm/llvm-project#138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires llvm/llvm-project#149336 to work.~~ Closes #104847
bors
added a commit
to rust-lang/rust
that referenced
this pull request
Aug 20, 2025
Pass `alloc-variant-zeroed` to LLVM Makes use of llvm/llvm-project#138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires llvm/llvm-project#149336 to work.~~ Closes #104847
bors
added a commit
to rust-lang/rust
that referenced
this pull request
Aug 20, 2025
Pass `alloc-variant-zeroed` to LLVM Makes use of llvm/llvm-project#138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires llvm/llvm-project#149336 to work.~~ Closes #104847
github-actions Bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Aug 21, 2025
Pass `alloc-variant-zeroed` to LLVM Makes use of llvm/llvm-project#138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires llvm/llvm-project#149336 to work.~~ Closes rust-lang/rust#104847
github-actions Bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Aug 25, 2025
Pass `alloc-variant-zeroed` to LLVM Makes use of llvm/llvm-project#138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires llvm/llvm-project#149336 to work.~~ Closes rust-lang/rust#104847
github-actions Bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Aug 26, 2025
Pass `alloc-variant-zeroed` to LLVM Makes use of llvm/llvm-project#138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires llvm/llvm-project#149336 to work.~~ Closes rust-lang#104847
Kobzol
pushed a commit
to Kobzol/stdarch
that referenced
this pull request
Nov 2, 2025
Pass `alloc-variant-zeroed` to LLVM Makes use of llvm/llvm-project#138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires llvm/llvm-project#149336 to work.~~ Closes rust-lang/rust#104847
Kobzol
pushed a commit
to Kobzol/rustc_codegen_gcc
that referenced
this pull request
Dec 21, 2025
Pass `alloc-variant-zeroed` to LLVM Makes use of llvm/llvm-project#138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires llvm/llvm-project#149336 to work.~~ Closes rust-lang/rust#104847
Kobzol
pushed a commit
to Kobzol/rustc_codegen_cranelift
that referenced
this pull request
Dec 29, 2025
Pass `alloc-variant-zeroed` to LLVM Makes use of llvm/llvm-project#138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires llvm/llvm-project#149336 to work.~~ Closes rust-lang/rust#104847
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc #138299
rustc sets
allockind("uninitialized")- if we copy the attributes as-is when creating a dummy function, Verify complains aboutallockind("uninitialized,zeroed")conflicting, so we need to clear the flag.