diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-11-09 07:11:37 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-11-09 07:11:37 +0000 |
commit | 89d093d5b69d21b5a4f81b969597bd76b6327cb5 (patch) | |
tree | 602190a913525e455bc1939c82db40e1071800f6 /test/Analysis/ScalarEvolution | |
parent | c6bcf4315c568610b89e4c79898cfe36ff2e4905 (diff) |
Don't forget to check FlagNW when determining whether an AddRecExpr will wrap
or not. Patch by Brendon Cahoon!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144173 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/ScalarEvolution')
-rw-r--r-- | test/Analysis/ScalarEvolution/trip-count12.ll | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/Analysis/ScalarEvolution/trip-count12.ll b/test/Analysis/ScalarEvolution/trip-count12.ll new file mode 100644 index 0000000000..8f960e1c1c --- /dev/null +++ b/test/Analysis/ScalarEvolution/trip-count12.ll @@ -0,0 +1,35 @@ +; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s + +; CHECK: Determining loop execution counts for: @test +; CHECK: Loop %for.body: backedge-taken count is ((-2 + %len) /u 2) +; CHECK: Loop %for.body: max backedge-taken count is 1073741823 + +define zeroext i16 @test(i16* nocapture %p, i32 %len) nounwind readonly { +entry: + %cmp2 = icmp sgt i32 %len, 1 + br i1 %cmp2, label %for.body.preheader, label %for.end + +for.body.preheader: ; preds = %entry + br label %for.body + +for.body: ; preds = %for.body, %for.body.preheader + %p.addr.05 = phi i16* [ %incdec.ptr, %for.body ], [ %p, %for.body.preheader ] + %len.addr.04 = phi i32 [ %sub, %for.body ], [ %len, %for.body.preheader ] + %res.03 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ] + %incdec.ptr = getelementptr inbounds i16* %p.addr.05, i32 1 + %0 = load i16* %p.addr.05, align 2 + %conv = zext i16 %0 to i32 + %add = add i32 %conv, %res.03 + %sub = add nsw i32 %len.addr.04, -2 + %cmp = icmp sgt i32 %sub, 1 + br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge + +for.cond.for.end_crit_edge: ; preds = %for.body + %extract.t = trunc i32 %add to i16 + br label %for.end + +for.end: ; preds = %for.cond.for.end_crit_edge, %entry + %res.0.lcssa.off0 = phi i16 [ %extract.t, %for.cond.for.end_crit_edge ], [ 0, %entry ] + ret i16 %res.0.lcssa.off0 +} + |