diff options
author | Andrew Trick <atrick@apple.com> | 2013-05-31 16:42:41 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2013-05-31 16:42:41 +0000 |
commit | 9c8e1f93b419299aa9a416ada3b7190ce4a1f1b6 (patch) | |
tree | 5b3b3680c1da4ff6da33e2cc910cd76a8e1a9071 /test/Analysis/ScalarEvolution | |
parent | 52aaf6a4a9a32e4493f7cb01eb2c19dc5f795932 (diff) | |
download | external_llvm-9c8e1f93b419299aa9a416ada3b7190ce4a1f1b6.zip external_llvm-9c8e1f93b419299aa9a416ada3b7190ce4a1f1b6.tar.gz external_llvm-9c8e1f93b419299aa9a416ada3b7190ce4a1f1b6.tar.bz2 |
Unit test for SCEV fix r182989, PR16130.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183017 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/ScalarEvolution')
-rw-r--r-- | test/Analysis/ScalarEvolution/trip-count10.ll | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/test/Analysis/ScalarEvolution/trip-count10.ll b/test/Analysis/ScalarEvolution/trip-count10.ll index 546e1dc..ead80b9 100644 --- a/test/Analysis/ScalarEvolution/trip-count10.ll +++ b/test/Analysis/ScalarEvolution/trip-count10.ll @@ -3,7 +3,7 @@ ; Trip counts with trivial exit conditions. ; CHECK: Determining loop execution counts for: @a -; CHECK: Loop %loop: Unpredictable backedge-taken count. +; CHECK: Loop %loop: Unpredictable backedge-taken count. ; CHECK: Loop %loop: Unpredictable max backedge-taken count. ; CHECK: Determining loop execution counts for: @b @@ -15,8 +15,8 @@ ; CHECK: Loop %loop: max backedge-taken count is false ; CHECK: Determining loop execution counts for: @d -; CHECK: Loop %loop: Unpredictable backedge-taken count. -; CHECK: Loop %loop: Unpredictable max backedge-taken count. +; CHECK: Loop %loop: Unpredictable backedge-taken count. +; CHECK: Loop %loop: Unpredictable max backedge-taken count. define void @a(i64 %n) nounwind { entry: @@ -124,3 +124,28 @@ loop: return: ret void } + +; PR16130: Loop exit depends on an 'or' expression. +; One side of the expression test against a value that will be skipped. +; We can't assume undefined behavior just because we have an NSW flag. +; +; CHECK: Determining loop execution counts for: @exit_orcond_nsw +; CHECK: Loop %for.body.i: Unpredictable backedge-taken count. +; CHECK: Loop %for.body.i: max backedge-taken count is 1 +define void @exit_orcond_nsw(i32 *%a) nounwind { +entry: + br label %for.body.i + +for.body.i: ; preds = %for.body.i, %entry + %b.01.i = phi i32 [ 0, %entry ], [ %add.i, %for.body.i ] + %tobool.i = icmp ne i32 %b.01.i, 0 + %add.i = add nsw i32 %b.01.i, 8 + %cmp.i = icmp eq i32 %add.i, 13 + %or.cond = or i1 %tobool.i, %cmp.i + br i1 %or.cond, label %exit, label %for.body.i + +exit: ; preds = %for.body.i + %b.01.i.lcssa = phi i32 [ %b.01.i, %for.body.i ] + store i32 %b.01.i.lcssa, i32* %a, align 4 + ret void +} |