Skip to content

Commit 58e8c79

Browse files
committed
Revert "[SCEV] add no wrap flag for SCEVAddExpr."
This reverts r366419 because the analysis performed is within the context of the loop and it's only valid to add wrapping flags to "global" expressions if they're always correct. llvm-svn: 373184
1 parent 0f30960 commit 58e8c79

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4992,7 +4992,7 @@ const SCEV *ScalarEvolution::createSimpleAffineAddRec(PHINode *PN,
49924992
// overflow.
49934993
if (auto *BEInst = dyn_cast<Instruction>(BEValueV))
49944994
if (isLoopInvariant(Accum, L) && isAddRecNeverPoison(BEInst, L))
4995-
(void)getAddRecExpr(getAddExpr(StartVal, Accum, Flags), Accum, L, Flags);
4995+
(void)getAddRecExpr(getAddExpr(StartVal, Accum), Accum, L, Flags);
49964996

49974997
return PHISCEV;
49984998
}

llvm/test/Analysis/ScalarEvolution/limit-depth.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ define void @test_mul(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) {
4646
define void @test_sext(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) {
4747
; CHECK-LABEL: @test_sext
4848
; CHECK: %se2 = sext i64 %iv2.inc to i128
49-
; CHECK-NEXT: --> {(1 + (sext i64 {(sext i32 (1 + %a)<nsw> to i64),+,1}<nsw><%loop> to i128))<nsw>,+,1}<nsw><%loop2>
49+
; CHECK-NEXT: --> {(1 + (sext i64 {(sext i32 (1 + %a) to i64),+,1}<nsw><%loop> to i128))<nsw>,+,1}<nsw><%loop2>
5050
entry:
5151
br label %loop
5252

llvm/test/Analysis/ScalarEvolution/nsw.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ bb5: ; preds = %bb2
163163
declare void @f(i32)
164164

165165
; CHECK-LABEL: nswnowrap
166-
; CHECK: --> {(1 + %v)<nsw>,+,1}<nsw><%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (2 + %v)
166+
; CHECK: --> {(1 + %v)<nsw>,+,1}<nsw><%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (1 + ((1 + %v)<nsw> smax %v))
167167
define void @nswnowrap(i32 %v, i32* %buf) {
168168
entry:
169169
%add = add nsw i32 %v, 1

llvm/test/Analysis/ScalarEvolution/trip-count12.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
22

33
; CHECK: Determining loop execution counts for: @test
4-
; CHECK: Loop %for.body: backedge-taken count is ((-2 + %len)<nsw> /u 2)
4+
; CHECK: Loop %for.body: backedge-taken count is ((-2 + %len) /u 2)
55
; CHECK: Loop %for.body: max backedge-taken count is 1073741823
66

77
define zeroext i16 @test(i16* nocapture %p, i32 %len) nounwind readonly {

llvm/test/Analysis/ScalarEvolution/trip-count9.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ exit:
179179
}
180180

181181
; CHECK: Determining loop execution counts for: @nsw_startx
182-
; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x)<nsw> smax %n))
182+
; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n))
183183
; CHECK: Loop %loop: max backedge-taken count is -1
184184
define void @nsw_startx(i4 %n, i4 %x) {
185185
entry:
@@ -195,7 +195,7 @@ exit:
195195
}
196196

197197
; CHECK: Determining loop execution counts for: @nsw_startx_step2
198-
; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x)<nsw> smax %n)) /u 2)
198+
; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax %n)) /u 2)
199199
; CHECK: Loop %loop: max backedge-taken count is 7
200200
define void @nsw_startx_step2(i4 %n, i4 %x) {
201201
entry:
@@ -381,7 +381,7 @@ exit:
381381
}
382382

383383
; CHECK: Determining loop execution counts for: @even_nsw_startx
384-
; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x)<nsw> smax (2 * %n)))
384+
; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n)))
385385
; CHECK: Loop %loop: max backedge-taken count is -2
386386
define void @even_nsw_startx(i4 %n, i4 %x) {
387387
entry:
@@ -398,7 +398,7 @@ exit:
398398
}
399399

400400
; CHECK: Determining loop execution counts for: @even_nsw_startx_step2
401-
; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x)<nsw> smax (2 * %n))) /u 2)
401+
; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2)
402402
; CHECK: Loop %loop: max backedge-taken count is 7
403403
define void @even_nsw_startx_step2(i4 %n, i4 %x) {
404404
entry:

0 commit comments

Comments
 (0)