Skip to content

Commit 7b3b4a5

Browse files
authored
IR: Use poison in dropDroppableUse (#134576)
1 parent 31ef7ac commit 7b3b4a5

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

llvm/lib/IR/Value.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ void Value::dropDroppableUse(Use &U) {
221221
if (OpNo == 0)
222222
U.set(ConstantInt::getTrue(Assume->getContext()));
223223
else {
224-
U.set(UndefValue::get(U.get()->getType()));
224+
U.set(PoisonValue::get(U.get()->getType()));
225225
CallInst::BundleOpInfo &BOI = Assume->getBundleOpInfoForOperand(OpNo);
226226
BOI.Tag = Assume->getContext().pImpl->getOrInsertBundleTag("ignore");
227227
}

llvm/test/Transforms/Mem2Reg/ignore-droppable.ll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ declare void @llvm.lifetime.end.p0(i64 %size, ptr nocapture %ptr)
77

88
define void @positive_assume_uses(ptr %arg) {
99
; CHECK-LABEL: @positive_assume_uses(
10-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(ptr [[ARG:%.*]]), "ignore"(ptr undef, i64 2) ]
11-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef, i64 8), "nonnull"(ptr [[ARG]]) ]
10+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(ptr [[ARG:%.*]]), "ignore"(ptr poison, i64 2) ]
11+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison, i64 8), "nonnull"(ptr [[ARG]]) ]
1212
; CHECK-NEXT: ret void
1313
;
1414
%A = alloca i32
@@ -35,8 +35,8 @@ define void @negative_assume_condition_use() {
3535

3636
define void @positive_multiple_assume_uses() {
3737
; CHECK-LABEL: @positive_multiple_assume_uses(
38-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef, i64 8), "ignore"(ptr undef, i64 16) ]
39-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef), "ignore"(ptr undef, i64 2) ]
38+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison, i64 8), "ignore"(ptr poison, i64 16) ]
39+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison), "ignore"(ptr poison, i64 2) ]
4040
; CHECK-NEXT: ret void
4141
;
4242
%A = alloca {i8, i16}
@@ -48,8 +48,8 @@ define void @positive_multiple_assume_uses() {
4848

4949
define void @positive_gep_assume_uses() {
5050
; CHECK-LABEL: @positive_gep_assume_uses(
51-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef, i64 8), "ignore"(ptr undef, i64 16) ]
52-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef), "ignore"(ptr undef, i64 2) ]
51+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison, i64 8), "ignore"(ptr poison, i64 16) ]
52+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison), "ignore"(ptr poison, i64 2) ]
5353
; CHECK-NEXT: ret void
5454
;
5555
%A = alloca {i8, i16}
@@ -64,9 +64,9 @@ define void @positive_gep_assume_uses() {
6464

6565
define void @positive_mixed_assume_uses() {
6666
; CHECK-LABEL: @positive_mixed_assume_uses(
67-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef), "ignore"(ptr undef, i64 8), "ignore"(ptr undef, i64 16) ]
68-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef), "ignore"(ptr undef, i64 2), "ignore"(ptr undef) ]
69-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef), "ignore"(ptr undef, i64 2), "ignore"(ptr undef) ]
67+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison), "ignore"(ptr poison, i64 8), "ignore"(ptr poison, i64 16) ]
68+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison), "ignore"(ptr poison, i64 2), "ignore"(ptr poison) ]
69+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison), "ignore"(ptr poison, i64 2), "ignore"(ptr poison) ]
7070
; CHECK-NEXT: ret void
7171
;
7272
%A = alloca i8

llvm/test/Transforms/SROA/assume.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ target triple = "x86_64-unknown-linux-gnu"
1414
define void @_ZN2bg2baIiEC2ES_(i64 %v) {
1515
; CHECK-LABEL: @_ZN2bg2baIiEC2ES_(
1616
; CHECK-NEXT: entry:
17-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef) ]
17+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison) ]
1818
; CHECK-NEXT: ret void
1919
;
2020
entry:

llvm/test/Transforms/SROA/ignore-droppable.ll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ declare void @llvm.lifetime.end.p0(i64 %size, ptr nocapture %ptr)
88

99
define void @positive_assume_uses(ptr %arg) {
1010
; CHECK-LABEL: @positive_assume_uses(
11-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(ptr [[ARG:%.*]]), "ignore"(ptr undef, i64 2) ]
12-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef, i64 8), "nonnull"(ptr [[ARG]]) ]
11+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(ptr [[ARG:%.*]]), "ignore"(ptr poison, i64 2) ]
12+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison, i64 8), "nonnull"(ptr [[ARG]]) ]
1313
; CHECK-NEXT: ret void
1414
;
1515
%A = alloca i32
@@ -36,8 +36,8 @@ define void @negative_assume_condition_use() {
3636

3737
define void @positive_multiple_assume_uses() {
3838
; CHECK-LABEL: @positive_multiple_assume_uses(
39-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef, i64 8), "ignore"(ptr undef, i64 16) ]
40-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef), "ignore"(ptr undef, i64 2) ]
39+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison, i64 8), "ignore"(ptr poison, i64 16) ]
40+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison), "ignore"(ptr poison, i64 2) ]
4141
; CHECK-NEXT: ret void
4242
;
4343
%A = alloca {i8, i16}
@@ -49,8 +49,8 @@ define void @positive_multiple_assume_uses() {
4949

5050
define void @positive_gep_assume_uses() {
5151
; CHECK-LABEL: @positive_gep_assume_uses(
52-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef, i64 8), "ignore"(ptr undef, i64 16) ]
53-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef), "ignore"(ptr undef, i64 2) ]
52+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison, i64 8), "ignore"(ptr poison, i64 16) ]
53+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison), "ignore"(ptr poison, i64 2) ]
5454
; CHECK-NEXT: ret void
5555
;
5656
%A = alloca {i8, i16}
@@ -65,9 +65,9 @@ define void @positive_gep_assume_uses() {
6565

6666
define void @positive_mixed_assume_uses() {
6767
; CHECK-LABEL: @positive_mixed_assume_uses(
68-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef), "ignore"(ptr undef, i64 8), "ignore"(ptr undef, i64 16) ]
69-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef), "ignore"(ptr undef, i64 2), "ignore"(ptr undef) ]
70-
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr undef), "ignore"(ptr undef, i64 2), "ignore"(ptr undef) ]
68+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison), "ignore"(ptr poison, i64 8), "ignore"(ptr poison, i64 16) ]
69+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison), "ignore"(ptr poison, i64 2), "ignore"(ptr poison) ]
70+
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "ignore"(ptr poison), "ignore"(ptr poison, i64 2), "ignore"(ptr poison) ]
7171
; CHECK-NEXT: ret void
7272
;
7373
%A = alloca i8

0 commit comments

Comments
 (0)