llvm.org GIT mirror llvm / ba5b64e
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373184 91177308-0d34-0410-b5e6-96231b3b80d8 Tim Northover 1 year, 21 days ago
5 changed file(s) with 8 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
49914991 // overflow.
49924992 if (auto *BEInst = dyn_cast(BEValueV))
49934993 if (isLoopInvariant(Accum, L) && isAddRecNeverPoison(BEInst, L))
4994 (void)getAddRecExpr(getAddExpr(StartVal, Accum, Flags), Accum, L, Flags);
4994 (void)getAddRecExpr(getAddExpr(StartVal, Accum), Accum, L, Flags);
49954995
49964996 return PHISCEV;
49974997 }
4545 define void @test_sext(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) {
4646 ; CHECK-LABEL: @test_sext
4747 ; CHECK: %se2 = sext i64 %iv2.inc to i128
48 ; CHECK-NEXT: --> {(1 + (sext i64 {(sext i32 (1 + %a) to i64),+,1}<%loop> to i128)),+,1}<%loop2>
48 ; CHECK-NEXT: --> {(1 + (sext i64 {(sext i32 (1 + %a) to i64),+,1}<%loop> to i128)),+,1}<%loop2>
4949 entry:
5050 br label %loop
5151
162162 declare void @f(i32)
163163
164164 ; CHECK-LABEL: nswnowrap
165 ; CHECK: --> {(1 + %v),+,1}<%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (2 + %v)
165 ; CHECK: --> {(1 + %v),+,1}<%for.body>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (1 + ((1 + %v) smax %v))
166166 define void @nswnowrap(i32 %v, i32* %buf) {
167167 entry:
168168 %add = add nsw i32 %v, 1
0 ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
11
22 ; CHECK: Determining loop execution counts for: @test
3 ; CHECK: Loop %for.body: backedge-taken count is ((-2 + %len) /u 2)
3 ; CHECK: Loop %for.body: backedge-taken count is ((-2 + %len) /u 2)
44 ; CHECK: Loop %for.body: max backedge-taken count is 1073741823
55
66 define zeroext i16 @test(i16* nocapture %p, i32 %len) nounwind readonly {
178178 }
179179
180180 ; CHECK: Determining loop execution counts for: @nsw_startx
181 ; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n))
181 ; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax %n))
182182 ; CHECK: Loop %loop: max backedge-taken count is -1
183183 define void @nsw_startx(i4 %n, i4 %x) {
184184 entry:
194194 }
195195
196196 ; CHECK: Determining loop execution counts for: @nsw_startx_step2
197 ; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax %n)) /u 2)
197 ; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax %n)) /u 2)
198198 ; CHECK: Loop %loop: max backedge-taken count is 7
199199 define void @nsw_startx_step2(i4 %n, i4 %x) {
200200 entry:
380380 }
381381
382382 ; CHECK: Determining loop execution counts for: @even_nsw_startx
383 ; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n)))
383 ; CHECK: Loop %loop: backedge-taken count is (-1 + (-1 * %x) + ((1 + %x) smax (2 * %n)))
384384 ; CHECK: Loop %loop: max backedge-taken count is -2
385385 define void @even_nsw_startx(i4 %n, i4 %x) {
386386 entry:
397397 }
398398
399399 ; CHECK: Determining loop execution counts for: @even_nsw_startx_step2
400 ; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2)
400 ; CHECK: Loop %loop: backedge-taken count is ((-1 + (-1 * %x) + ((2 + %x) smax (2 * %n))) /u 2)
401401 ; CHECK: Loop %loop: max backedge-taken count is 7
402402 define void @even_nsw_startx_step2(i4 %n, i4 %x) {
403403 entry: