summaryrefslogtreecommitdiffstats
path: root/llvm/test/Analysis/ScalarEvolution
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-11-29 02:16:38 +0000
committerAndrew Trick <atrick@apple.com>2011-11-29 02:16:38 +0000
commitd25089f8e098d71fa27c56fc0ad440fb833617ca (patch)
tree31fb4a8ae185308c9107b5a88a373dfec72a74f2 /llvm/test/Analysis/ScalarEvolution
parentd912a5b2e39536b7cb343c16e102cefa70dcfbd4 (diff)
downloadbcm5719-llvm-d25089f8e098d71fa27c56fc0ad440fb833617ca.tar.gz
bcm5719-llvm-d25089f8e098d71fa27c56fc0ad440fb833617ca.zip
SCEV fix. In general, Add/Mul expressions should not inherit NSW/NUW.
This reverts r139450, fixes r139453, and adds much needed comments and a unit test. llvm-svn: 145367
Diffstat (limited to 'llvm/test/Analysis/ScalarEvolution')
-rw-r--r--llvm/test/Analysis/ScalarEvolution/nsw.ll20
1 files changed, 19 insertions, 1 deletions
diff --git a/llvm/test/Analysis/ScalarEvolution/nsw.ll b/llvm/test/Analysis/ScalarEvolution/nsw.ll
index da35a6cf7ae..659cf4f8da9 100644
--- a/llvm/test/Analysis/ScalarEvolution/nsw.ll
+++ b/llvm/test/Analysis/ScalarEvolution/nsw.ll
@@ -103,4 +103,22 @@ for.body.i.i: ; preds = %entry, %for.body.i.
; CHECK: Loop %for.body.i.i: max backedge-taken count is ((-4 + (-1 * %begin) + %end) /u 4)
_ZSt4fillIPiiEvT_S1_RKT0_.exit: ; preds = %for.body.i.i, %entry
ret void
-} \ No newline at end of file
+}
+
+; A single AddExpr exists for (%a + %b), which is not always <nsw>.
+; CHECK: @addnsw
+; CHECK-NOT: --> (%a + %b)<nsw>
+define i32 @addnsw(i32 %a, i32 %b) nounwind ssp {
+entry:
+ %tmp = add i32 %a, %b
+ %cmp = icmp sgt i32 %tmp, 0
+ br i1 %cmp, label %greater, label %exit
+
+greater:
+ %tmp2 = add nsw i32 %a, %b
+ br label %exit
+
+exit:
+ %result = phi i32 [ %a, %entry ], [ %tmp2, %greater ]
+ ret i32 %result
+}
OpenPOWER on IntegriCloud