Skip to content

Commit 0b9f1cc

Browse files
authored
[SCEV] Disallow simplifying phi(undef, X) to X (llvm#115109)
See the following case: ``` @GlobIntONE = global i32 0, align 4 define ptr @src() { entry: br label %for.body.peel.begin for.body.peel.begin: ; preds = %entry br label %for.body.peel for.body.peel: ; preds = %for.body.peel.begin br i1 true, label %cleanup.peel, label %cleanup.loopexit.peel cleanup.loopexit.peel: ; preds = %for.body.peel br label %cleanup.peel cleanup.peel: ; preds = %cleanup.loopexit.peel, %for.body.peel %retval.2.peel = phi ptr [ undef, %for.body.peel ], [ @GlobIntONE, %cleanup.loopexit.peel ] br i1 true, label %for.body.peel.next, label %cleanup7 for.body.peel.next: ; preds = %cleanup.peel br label %for.body.peel.next1 for.body.peel.next1: ; preds = %for.body.peel.next br label %entry.peel.newph entry.peel.newph: ; preds = %for.body.peel.next1 br label %for.body for.body: ; preds = %cleanup, %entry.peel.newph %retval.0 = phi ptr [ %retval.2.peel, %entry.peel.newph ], [ %retval.2, %cleanup ] br i1 false, label %cleanup, label %cleanup.loopexit cleanup.loopexit: ; preds = %for.body br label %cleanup cleanup: ; preds = %cleanup.loopexit, %for.body %retval.2 = phi ptr [ %retval.0, %for.body ], [ @GlobIntONE, %cleanup.loopexit ] br i1 false, label %for.body, label %cleanup7.loopexit cleanup7.loopexit: ; preds = %cleanup %retval.2.lcssa.ph = phi ptr [ %retval.2, %cleanup ] br label %cleanup7 cleanup7: ; preds = %cleanup7.loopexit, %cleanup.peel %retval.2.lcssa = phi ptr [ %retval.2.peel, %cleanup.peel ], [ %retval.2.lcssa.ph, %cleanup7.loopexit ] ret ptr %retval.2.lcssa } define ptr @tgt() { entry: br label %for.body.peel.begin for.body.peel.begin: ; preds = %entry br label %for.body.peel for.body.peel: ; preds = %for.body.peel.begin br i1 true, label %cleanup.peel, label %cleanup.loopexit.peel cleanup.loopexit.peel: ; preds = %for.body.peel br label %cleanup.peel cleanup.peel: ; preds = %cleanup.loopexit.peel, %for.body.peel %retval.2.peel = phi ptr [ undef, %for.body.peel ], [ @GlobIntONE, %cleanup.loopexit.peel ] br i1 true, label %for.body.peel.next, label %cleanup7 for.body.peel.next: ; preds = %cleanup.peel br label %for.body.peel.next1 for.body.peel.next1: ; preds = %for.body.peel.next br label %entry.peel.newph entry.peel.newph: ; preds = %for.body.peel.next1 br label %for.body for.body: ; preds = %cleanup, %entry.peel.newph br i1 false, label %cleanup, label %cleanup.loopexit cleanup.loopexit: ; preds = %for.body br label %cleanup cleanup: ; preds = %cleanup.loopexit, %for.body br i1 false, label %for.body, label %cleanup7.loopexit cleanup7.loopexit: ; preds = %cleanup %retval.2.lcssa.ph = phi ptr [ %retval.2.peel, %cleanup ] br label %cleanup7 cleanup7: ; preds = %cleanup7.loopexit, %cleanup.peel %retval.2.lcssa = phi ptr [ %retval.2.peel, %cleanup.peel ], [ %retval.2.lcssa.ph, %cleanup7.loopexit ] ret ptr %retval.2.lcssa } ``` 1. `simplifyInstruction(%retval.2.peel)` returns `@GlobIntONE`. Thus, `ScalarEvolution::createNodeForPHI` returns SCEV expr `@GlobIntONE` for `%retval.2.peel`. 2. `SimplifyIndvar::replaceIVUserWithLoopInvariant` tries to replace the use of `%retval.2.peel` in `%retval.2.lcssa.ph` with `@GlobIntONE`. 3. `simplifyLoopAfterUnroll -> simplifyLoopIVs -> SCEVExpander::expand` reuses `%retval.2.peel = phi ptr [ undef, %for.body.peel ], [ @GlobIntONE, %cleanup.loopexit.peel ]` to generate code for `@GlobIntONE`. It is incorrect. This patch disallows simplifying `phi(undef, X)` to `X` by setting `CanUseUndef` to false. Closes llvm#114879.
1 parent 3850801 commit 0b9f1cc

16 files changed

+106
-37
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -6023,7 +6023,11 @@ const SCEV *ScalarEvolution::createNodeForPHI(PHINode *PN) {
60236023
if (const SCEV *S = createAddRecFromPHI(PN))
60246024
return S;
60256025

6026-
if (Value *V = simplifyInstruction(PN, {getDataLayout(), &TLI, &DT, &AC}))
6026+
// We do not allow simplifying phi (undef, X) to X here, to avoid reusing the
6027+
// phi node for X.
6028+
if (Value *V = simplifyInstruction(
6029+
PN, {getDataLayout(), &TLI, &DT, &AC, /*CtxI=*/nullptr,
6030+
/*UseInstrInfo=*/true, /*CanUseUndef=*/false}))
60276031
return getSCEV(V);
60286032

60296033
if (const SCEV *S = createNodeFromSelectLikePHI(PN))

llvm/test/Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ define i8 @test_pr52023(i1 %c.1, i1 %c.2) {
4848
; CHECK-NEXT: br label [[LOOP_1:%.*]]
4949
; CHECK: loop.1:
5050
; CHECK-NEXT: [[INC79:%.*]] = phi i8 [ [[TMP0:%.*]], [[LOOP_1_LATCH:%.*]] ], [ 0, [[ENTRY:%.*]] ]
51-
; CHECK-NEXT: [[TMP0]] = add i8 [[INC79]], 1
51+
; CHECK-NEXT: [[TMP1:%.*]] = add i8 [[INC79]], 1
5252
; CHECK-NEXT: br label [[LOOP_2:%.*]]
5353
; CHECK: loop.2:
5454
; CHECK-NEXT: br i1 [[C_1:%.*]], label [[LOOP_2_LATCH:%.*]], label [[LOOP_1_LATCH]]
5555
; CHECK: loop.2.latch:
5656
; CHECK-NEXT: br label [[LOOP_1_LATCH]]
5757
; CHECK: loop.1.latch:
58+
; CHECK-NEXT: [[TMP0]] = phi i8 [ [[TMP1]], [[LOOP_2_LATCH]] ], [ undef, [[LOOP_2]] ]
5859
; CHECK-NEXT: br i1 [[C_2:%.*]], label [[EXIT:%.*]], label [[LOOP_1]]
5960
; CHECK: exit:
6061
; CHECK-NEXT: [[INC_LCSSA_LCSSA:%.*]] = phi i8 [ [[TMP0]], [[LOOP_1_LATCH]] ]

llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll

+4-2
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,13 @@ define void @identityphi(i32 %limit) nounwind {
260260
; CHECK-NEXT: entry:
261261
; CHECK-NEXT: br label [[LOOP:%.*]]
262262
; CHECK: loop:
263-
; CHECK-NEXT: br i1 undef, label [[IF_THEN:%.*]], label [[CONTROL:%.*]]
263+
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[CONTROL:%.*]] ]
264+
; CHECK-NEXT: br i1 undef, label [[IF_THEN:%.*]], label [[CONTROL]]
264265
; CHECK: if.then:
265266
; CHECK-NEXT: br label [[CONTROL]]
266267
; CHECK: control:
267-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[LIMIT:%.*]]
268+
; CHECK-NEXT: [[IV_NEXT]] = phi i32 [ [[IV]], [[LOOP]] ], [ undef, [[IF_THEN]] ]
269+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[IV_NEXT]], [[LIMIT:%.*]]
268270
; CHECK-NEXT: br i1 [[CMP]], label [[LOOP]], label [[EXIT:%.*]]
269271
; CHECK: exit:
270272
; CHECK-NEXT: ret void

llvm/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll

+8-8
Original file line numberDiff line numberDiff line change
@@ -156,29 +156,29 @@ define fastcc void @test3(ptr nocapture %u) nounwind uwtable ssp {
156156
; CHECK: for.inc8.us.i:
157157
; CHECK-NEXT: br i1 true, label [[MESHBB1_LOOPEXIT:%.*]], label [[MESHBB:%.*]]
158158
; CHECK: for.body3.us.i:
159-
; CHECK-NEXT: [[INDVARS_IV_I_SV_PHI:%.*]] = phi i64 [ [[INDVARS_IV_NEXT_I:%.*]], [[MESHBB]] ], [ 0, [[FOR_BODY3_LR_PH_US_I:%.*]] ]
159+
; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ [[LSR_IV_NEXT:%.*]], [[MESHBB]] ], [ [[TMP3:%.*]], [[FOR_BODY3_LR_PH_US_I:%.*]] ]
160+
; CHECK-NEXT: [[SCEVGEP:%.*]] = phi ptr [ [[SCEVGEP1:%.*]], [[MESHBB]] ], [ [[U:%.*]], [[FOR_BODY3_LR_PH_US_I]] ]
160161
; CHECK-NEXT: [[OPQ_SA_CALC12:%.*]] = sub i32 undef, 227
161-
; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[LSR_IV:%.*]], [[INDVARS_IV_I_SV_PHI]]
162-
; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[TMP0]] to i32
163162
; CHECK-NEXT: [[MUL_I_US_I:%.*]] = mul nsw i32 0, [[TMP]]
164-
; CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[INDVARS_IV_I_SV_PHI]], 3
165-
; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[U:%.*]], i64 [[TMP1]]
166163
; CHECK-NEXT: [[TMP2:%.*]] = load double, ptr [[SCEVGEP]], align 8
167164
; CHECK-NEXT: br i1 undef, label [[FOR_INC8_US_I:%.*]], label [[MESHBB]]
168165
; CHECK: for.body3.lr.ph.us.i.loopexit:
169-
; CHECK-NEXT: [[LSR_IV_NEXT:%.*]] = add i64 [[LSR_IV]], 1
170166
; CHECK-NEXT: br label [[FOR_BODY3_LR_PH_US_I]]
171167
; CHECK: for.body3.lr.ph.us.i:
172-
; CHECK-NEXT: [[LSR_IV]] = phi i64 [ [[LSR_IV_NEXT]], [[FOR_BODY3_LR_PH_US_I_LOOPEXIT:%.*]] ], [ undef, [[MESHBB1]] ]
168+
; CHECK-NEXT: [[LSR_IV:%.*]] = phi i64 [ undef, [[MESHBB1]] ], [ [[INDVARS_IV8_I_SV_PHI24:%.*]], [[FOR_BODY3_LR_PH_US_I_LOOPEXIT:%.*]] ]
173169
; CHECK-NEXT: [[ARRAYIDX_US_I:%.*]] = getelementptr inbounds double, ptr undef, i64 [[LSR_IV]]
170+
; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[LSR_IV]], 1
171+
; CHECK-NEXT: [[TMP3]] = trunc i64 [[LSR_IV]] to i32
174172
; CHECK-NEXT: br label [[FOR_BODY3_US_I:%.*]]
175173
; CHECK: for.inc8.us.i2:
176174
; CHECK-NEXT: unreachable
177175
; CHECK: eval_At_times_u.exit:
178176
; CHECK-NEXT: ret void
179177
; CHECK: meshBB:
178+
; CHECK-NEXT: [[INDVARS_IV8_I_SV_PHI24]] = phi i64 [ undef, [[FOR_BODY3_US_I]] ], [ [[TMP1]], [[FOR_INC8_US_I]] ]
180179
; CHECK-NEXT: [[MESHSTACKVARIABLE_PHI:%.*]] = phi i32 [ [[OPQ_SA_CALC12]], [[FOR_BODY3_US_I]] ], [ undef, [[FOR_INC8_US_I]] ]
181-
; CHECK-NEXT: [[INDVARS_IV_NEXT_I]] = add i64 [[INDVARS_IV_I_SV_PHI]], 1
180+
; CHECK-NEXT: [[SCEVGEP1]] = getelementptr i8, ptr [[SCEVGEP]], i64 8
181+
; CHECK-NEXT: [[LSR_IV_NEXT]] = add i32 [[TMP]], 1
182182
; CHECK-NEXT: br i1 true, label [[FOR_BODY3_LR_PH_US_I_LOOPEXIT]], label [[FOR_BODY3_US_I]]
183183
; CHECK: meshBB1.loopexit:
184184
; CHECK-NEXT: br label [[MESHBB1]]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -S -passes=loop-unroll-full -unroll-full-max-count=1 %s | FileCheck %s
3+
4+
@GlobIntONE = global i32 0, align 4
5+
6+
; Make sure we don't reuse the phi (undef, X) for X.
7+
8+
define ptr @test() {
9+
; CHECK-LABEL: define ptr @test() {
10+
; CHECK-NEXT: [[ENTRY:.*:]]
11+
; CHECK-NEXT: br label %[[FOR_BODY_PEEL_BEGIN:.*]]
12+
; CHECK: [[FOR_BODY_PEEL_BEGIN]]:
13+
; CHECK-NEXT: br label %[[FOR_BODY_PEEL:.*]]
14+
; CHECK: [[FOR_BODY_PEEL]]:
15+
; CHECK-NEXT: br i1 true, label %[[CLEANUP_PEEL:.*]], label %[[CLEANUP_LOOPEXIT_PEEL:.*]]
16+
; CHECK: [[CLEANUP_LOOPEXIT_PEEL]]:
17+
; CHECK-NEXT: br label %[[CLEANUP_PEEL]]
18+
; CHECK: [[CLEANUP_PEEL]]:
19+
; CHECK-NEXT: [[RETVAL_2_PEEL:%.*]] = phi ptr [ undef, %[[FOR_BODY_PEEL]] ], [ @GlobIntONE, %[[CLEANUP_LOOPEXIT_PEEL]] ]
20+
; CHECK-NEXT: br i1 true, label %[[FOR_BODY_PEEL_NEXT:.*]], label %[[CLEANUP2:.*]]
21+
; CHECK: [[FOR_BODY_PEEL_NEXT]]:
22+
; CHECK-NEXT: br label %[[FOR_BODY_PEEL_NEXT1:.*]]
23+
; CHECK: [[FOR_BODY_PEEL_NEXT1]]:
24+
; CHECK-NEXT: br label %[[ENTRY_PEEL_NEWPH:.*]]
25+
; CHECK: [[ENTRY_PEEL_NEWPH]]:
26+
; CHECK-NEXT: br label %[[FOR_BODY:.*]]
27+
; CHECK: [[FOR_BODY]]:
28+
; CHECK-NEXT: br i1 false, label %[[CLEANUP:.*]], label %[[CLEANUP_LOOPEXIT:.*]]
29+
; CHECK: [[CLEANUP_LOOPEXIT]]:
30+
; CHECK-NEXT: br label %[[CLEANUP]]
31+
; CHECK: [[CLEANUP]]:
32+
; CHECK-NEXT: br i1 false, label %[[FOR_BODY]], label %[[CLEANUP2_LOOPEXIT:.*]], !llvm.loop [[LOOP0:![0-9]+]]
33+
; CHECK: [[CLEANUP2_LOOPEXIT]]:
34+
; CHECK-NEXT: [[RETVAL_2_LCSSA_PH:%.*]] = phi ptr [ @GlobIntONE, %[[CLEANUP]] ]
35+
; CHECK-NEXT: br label %[[CLEANUP2]]
36+
; CHECK: [[CLEANUP2]]:
37+
; CHECK-NEXT: [[RETVAL_2_LCSSA:%.*]] = phi ptr [ [[RETVAL_2_PEEL]], %[[CLEANUP_PEEL]] ], [ [[RETVAL_2_LCSSA_PH]], %[[CLEANUP2_LOOPEXIT]] ]
38+
; CHECK-NEXT: ret ptr [[RETVAL_2_LCSSA]]
39+
;
40+
entry:
41+
br label %for.body
42+
43+
for.body:
44+
%retval.0 = phi ptr [ undef, %entry ], [ %retval.2, %cleanup ]
45+
%cmp1.not = phi i1 [ true, %entry ], [ false, %cleanup ]
46+
br i1 %cmp1.not, label %cleanup, label %cleanup.loopexit
47+
48+
cleanup.loopexit:
49+
br label %cleanup
50+
51+
cleanup:
52+
%retval.2 = phi ptr [ %retval.0, %for.body ], [ @GlobIntONE, %cleanup.loopexit ]
53+
br i1 %cmp1.not, label %for.body, label %cleanup2
54+
55+
cleanup2:
56+
%retval.2.lcssa = phi ptr [ %retval.2, %cleanup ]
57+
ret ptr %retval.2.lcssa
58+
}
59+
;.
60+
; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]]}
61+
; CHECK: [[META1]] = !{!"llvm.loop.peeled.count", i32 1}
62+
;.

llvm/test/Transforms/LoopVectorize/uniform-blend.ll

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ define void @blend_uniform_iv_trunc(i1 %c) {
1414
; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
1515
; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDEX]] to i16
1616
; CHECK-NEXT: [[TMP1:%.*]] = add i16 [[TMP0]], 0
17-
; CHECK-NEXT: [[PREDPHI:%.*]] = select i1 [[C]], i16 [[TMP1]], i16 undef
18-
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [32 x i16], ptr @dst, i16 0, i16 [[PREDPHI]]
19-
; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i16, ptr [[TMP2]], i32 0
17+
; CHECK-NEXT: [[TMP6:%.*]] = select i1 [[C]], i16 [[TMP1]], i16 poison
18+
; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [32 x i16], ptr @dst, i16 0, i16 [[TMP6]]
19+
; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i16, ptr [[TMP7]], i32 0
2020
; CHECK-NEXT: store <4 x i16> zeroinitializer, ptr [[TMP3]], align 2
2121
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
2222
; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i64 [[INDEX_NEXT]], 32
@@ -33,7 +33,7 @@ define void @blend_uniform_iv_trunc(i1 %c) {
3333
; CHECK: [[LOOP_NEXT]]:
3434
; CHECK-NEXT: br label %[[LOOP_LATCH]]
3535
; CHECK: [[LOOP_LATCH]]:
36-
; CHECK-NEXT: [[BLEND:%.*]] = phi i16 [ undef, %[[LOOP_HEADER]] ], [ [[IV_TRUNC_2]], %[[LOOP_NEXT]] ]
36+
; CHECK-NEXT: [[BLEND:%.*]] = phi i16 [ poison, %[[LOOP_HEADER]] ], [ [[IV_TRUNC_2]], %[[LOOP_NEXT]] ]
3737
; CHECK-NEXT: [[DST_PTR:%.*]] = getelementptr inbounds [32 x i16], ptr @dst, i16 0, i16 [[BLEND]]
3838
; CHECK-NEXT: store i16 0, ptr [[DST_PTR]], align 2
3939
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
@@ -54,7 +54,7 @@ loop.next: ; preds = %loop.header
5454
br label %loop.latch
5555

5656
loop.latch: ; preds = %loop.next, %loop.header
57-
%blend = phi i16 [ undef, %loop.header ], [ %iv.trunc.2, %loop.next ]
57+
%blend = phi i16 [ poison, %loop.header ], [ %iv.trunc.2, %loop.next ]
5858
%dst.ptr = getelementptr inbounds [32 x i16], ptr @dst, i16 0, i16 %blend
5959
store i16 0, ptr %dst.ptr
6060
%iv.next = add nuw nsw i64 %iv, 1
@@ -75,9 +75,9 @@ define void @blend_uniform_iv(i1 %c) {
7575
; CHECK: [[VECTOR_BODY]]:
7676
; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
7777
; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0
78-
; CHECK-NEXT: [[PREDPHI:%.*]] = select i1 [[C]], i64 [[TMP0]], i64 undef
79-
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [32 x i16], ptr @dst, i16 0, i64 [[PREDPHI]]
80-
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i16, ptr [[TMP1]], i32 0
78+
; CHECK-NEXT: [[TMP6:%.*]] = select i1 [[C]], i64 [[TMP0]], i64 poison
79+
; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [32 x i16], ptr @dst, i16 0, i64 [[TMP6]]
80+
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i16, ptr [[TMP7]], i32 0
8181
; CHECK-NEXT: store <4 x i16> zeroinitializer, ptr [[TMP2]], align 2
8282
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
8383
; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i64 [[INDEX_NEXT]], 32
@@ -93,7 +93,7 @@ define void @blend_uniform_iv(i1 %c) {
9393
; CHECK: [[LOOP_NEXT]]:
9494
; CHECK-NEXT: br label %[[LOOP_LATCH]]
9595
; CHECK: [[LOOP_LATCH]]:
96-
; CHECK-NEXT: [[BLEND:%.*]] = phi i64 [ undef, %[[LOOP_HEADER]] ], [ [[IV]], %[[LOOP_NEXT]] ]
96+
; CHECK-NEXT: [[BLEND:%.*]] = phi i64 [ poison, %[[LOOP_HEADER]] ], [ [[IV]], %[[LOOP_NEXT]] ]
9797
; CHECK-NEXT: [[DST_PTR:%.*]] = getelementptr inbounds [32 x i16], ptr @dst, i16 0, i64 [[BLEND]]
9898
; CHECK-NEXT: store i16 0, ptr [[DST_PTR]], align 2
9999
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
@@ -114,7 +114,7 @@ loop.next: ; preds = %loop.header
114114
br label %loop.latch
115115

116116
loop.latch: ; preds = %loop.next, %loop.header
117-
%blend = phi i64 [ undef, %loop.header ], [ %iv, %loop.next ]
117+
%blend = phi i64 [ poison, %loop.header ], [ %iv, %loop.next ]
118118
%dst.ptr = getelementptr inbounds [32 x i16], ptr @dst, i16 0, i64 %blend
119119
store i16 0, ptr %dst.ptr
120120
%iv.next = add nuw nsw i64 %iv, 1

llvm/unittests/Analysis/ScalarEvolutionTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ TEST_F(ScalarEvolutionsTest, SimplifiedPHI) {
139139
auto *Ty = Type::getInt32Ty(Context);
140140
auto *PN = PHINode::Create(Ty, 2, "", LoopBB->begin());
141141
PN->addIncoming(Constant::getNullValue(Ty), EntryBB);
142-
PN->addIncoming(UndefValue::get(Ty), LoopBB);
142+
PN->addIncoming(PoisonValue::get(Ty), LoopBB);
143143
ScalarEvolution SE = buildSE(*F);
144144
const SCEV *S1 = SE.getSCEV(PN);
145145
const SCEV *S2 = SE.getSCEV(PN);

polly/test/CodeGen/OpenMP/floord-as-argument-to-subfunction.ll

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ for.cond39.for.cond66.preheader.loopexit67_crit_edge: ; preds = %for.body42
2020
br label %for.cond66.preheader
2121

2222
for.cond66.preheader: ; preds = %for.cond39.for.cond66.preheader.loopexit67_crit_edge, %if.end
23-
%rawout1.3.ph = phi ptr [ %add.ptr62.lcssa, %for.cond39.for.cond66.preheader.loopexit67_crit_edge ], [ undef, %if.end ]
23+
%rawout1.3.ph = phi ptr [ %add.ptr62.lcssa, %for.cond39.for.cond66.preheader.loopexit67_crit_edge ], [ poison, %if.end ]
2424
%sb.3.ph = phi i32 [ 0, %for.cond39.for.cond66.preheader.loopexit67_crit_edge ], [ 0, %if.end ]
25-
%tspnt.3.ph = phi ptr [ undef, %for.cond39.for.cond66.preheader.loopexit67_crit_edge ], [ %tsOut, %if.end ]
25+
%tspnt.3.ph = phi ptr [ poison, %for.cond39.for.cond66.preheader.loopexit67_crit_edge ], [ %tsOut, %if.end ]
2626
br label %for.cond69.preheader
2727

2828
for.body42: ; preds = %if.end
@@ -31,12 +31,12 @@ for.body42: ; preds = %if.end
3131
for.cond69.preheader: ; preds = %for.end76, %for.cond66.preheader
3232
%tspnt.375 = phi ptr [ %incdec.ptr79, %for.end76 ], [ %tspnt.3.ph, %for.cond66.preheader ]
3333
%sb.374 = phi i32 [ %inc78, %for.end76 ], [ %sb.3.ph, %for.cond66.preheader ]
34-
%rawout1.373 = phi ptr [ undef, %for.end76 ], [ %rawout1.3.ph, %for.cond66.preheader ]
34+
%rawout1.373 = phi ptr [ poison, %for.end76 ], [ %rawout1.3.ph, %for.cond66.preheader ]
3535
br label %for.body71
3636

3737
for.body71: ; preds = %for.body71, %for.cond69.preheader
3838
%indvars.iv = phi i64 [ 0, %for.cond69.preheader ], [ %indvars.iv.next, %for.body71 ]
39-
%rawout1.469 = phi ptr [ %rawout1.373, %for.cond69.preheader ], [ undef, %for.body71 ]
39+
%rawout1.469 = phi ptr [ %rawout1.373, %for.cond69.preheader ], [ poison, %for.body71 ]
4040
%0 = load i64, ptr %rawout1.469, align 8
4141
%1 = shl nsw i64 %indvars.iv, 5
4242
%arrayidx73 = getelementptr inbounds double, ptr %tspnt.375, i64 %1

polly/test/CodeGen/inner_scev_sdiv_2.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ for.cond.60.preheader: ; preds = %for.body.51, %for.c
3434
ret void
3535

3636
for.body.51: ; preds = %for.body.51, %for.body.51.lr.ph
37-
%indvars.iv86 = phi i64 [ %2, %for.body.51.lr.ph ], [ undef, %for.body.51 ]
37+
%indvars.iv86 = phi i64 [ %2, %for.body.51.lr.ph ], [ poison, %for.body.51 ]
3838
%arrayidx53 = getelementptr inbounds float, ptr %0, i64 %indvars.iv86
3939
%3 = load float, ptr %arrayidx53, align 4
4040
%mul56 = fmul float %3, undef

polly/test/CodeGen/inner_scev_sdiv_3.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ end:
3636
ret i64 %div44.m
3737

3838
for.body.51: ; preds = %for.body.51, %for.body.51.lr.ph
39-
%indvars.iv86 = phi i64 [ %2, %for.body.51.lr.ph ], [ undef, %for.body.51 ]
39+
%indvars.iv86 = phi i64 [ %2, %for.body.51.lr.ph ], [ poison, %for.body.51 ]
4040
%arrayidx53 = getelementptr inbounds float, ptr %0, i64 %indvars.iv86
4141
%3 = load float, ptr %arrayidx53, align 4
4242
%mul56 = fmul float %3, undef

polly/test/CodeGen/non-affine-phi-node-expansion.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ bb1: ; preds = %bb
3131
br label %bb2
3232

3333
bb2: ; preds = %bb1, %bb
34-
%tmp = phi i1 [ true, %bb ], [ undef, %bb1 ]
34+
%tmp = phi i1 [ true, %bb ], [ poison, %bb1 ]
3535
br label %bb3
3636

3737
bb3: ; preds = %bb13, %bb2

polly/test/CodeGen/phi-defined-before-scop.ll

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ bb:
1919
br label %bb1
2020

2121
bb1: ; preds = %bb6, %bb
22-
%tmp2 = phi ptr [ %tmp7, %bb6 ], [ undef, %bb ]
22+
%tmp2 = phi ptr [ %tmp7, %bb6 ], [ poison, %bb ]
2323
%tmp = load ptr, ptr @global, align 8, !tbaa !1
2424
br label %bb3
2525

@@ -31,7 +31,7 @@ bb5: ; preds = %bb3
3131
br label %bb6
3232

3333
bb6: ; preds = %bb5, %bb3
34-
%tmp7 = phi ptr [ %tmp2, %bb3 ], [ undef, %bb5 ]
34+
%tmp7 = phi ptr [ %tmp2, %bb3 ], [ poison, %bb5 ]
3535
br i1 undef, label %bb8, label %bb1
3636

3737
bb8: ; preds = %bb6

polly/test/CodeGen/scop_expander_insert_point.ll

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ for.body17.lr.ph: ; preds = %for.end22, %for.con
2727
br label %for.body17
2828

2929
for.body17: ; preds = %for.body17, %for.body17.lr.ph
30-
%outvalue.141 = phi i64 [ undef, %for.body17.lr.ph ], [ %add19, %for.body17 ]
31-
%inptr.040 = phi ptr [ %add.ptr, %for.body17.lr.ph ], [ undef, %for.body17 ]
30+
%outvalue.141 = phi i64 [ poison, %for.body17.lr.ph ], [ %add19, %for.body17 ]
31+
%inptr.040 = phi ptr [ %add.ptr, %for.body17.lr.ph ], [ poison, %for.body17 ]
3232
%1 = load i8, ptr %inptr.040
3333
%add19 = mul nsw i64 0, %outvalue.141
3434
br i1 false, label %for.body17, label %for.end22

polly/test/CodeGen/stack-overflow-in-load-hoisting.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ for.cond.12.preheader.lr.ph: ; preds = %entry
4242
br label %for.body.14.lr.ph
4343

4444
for.body.14.lr.ph: ; preds = %for.end, %for.cond.12.preheader.lr.ph
45-
%d.050 = phi ptr [ %tmp3, %for.cond.12.preheader.lr.ph ], [ undef, %for.end ]
45+
%d.050 = phi ptr [ %tmp3, %for.cond.12.preheader.lr.ph ], [ poison, %for.end ]
4646
%w = getelementptr inbounds %struct.AudioVectorScopeContext.21.43.879.1209.1297.1319.1573, ptr %s, i32 0, i32 2
4747
%tmp4 = load i32, ptr %w, align 4
4848
%cmp13.46 = icmp sgt i32 %tmp4, 0

polly/test/ScopInfo/complex_domain_binary_condition.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ for.body104.lr.ph: ; preds = %entry
3535
br label %for.body104
3636

3737
for.body104: ; preds = %while.end146, %for.body104.lr.ph
38-
%indvars.iv = phi i64 [ %6, %for.body104.lr.ph ], [ undef, %while.end146 ]
38+
%indvars.iv = phi i64 [ %6, %for.body104.lr.ph ], [ poison, %while.end146 ]
3939
%7 = sub nsw i64 %indvars.iv, %idx.ext62
4040
%cmp107 = icmp slt i64 %7, -1
4141
%.op = xor i64 %7, -1

polly/test/ScopInfo/scev-div-with-evaluatable-divisor.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ for.body.lr.ph: ; preds = %entry
1717
br label %for.body
1818

1919
for.body: ; preds = %for.inc, %for.body.lr.ph
20-
%mj.017 = phi i32 [ 1, %for.body.lr.ph ], [ undef, %for.inc ]
20+
%mj.017 = phi i32 [ 1, %for.body.lr.ph ], [ poison, %for.inc ]
2121
br i1 true, label %if.else, label %if.then
2222

2323
if.then: ; preds = %for.body

0 commit comments

Comments
 (0)