summaryrefslogtreecommitdiffstats
path: root/llvm/test/Analysis/ScalarEvolution
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-06-28 23:44:57 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-06-28 23:44:57 +0000
commit474112d82c7b92ea8d5ecdeaf89c9e4db34e1a4a (patch)
tree28636f5b1699dd9260ab65437f88e8b9e69a9a90 /llvm/test/Analysis/ScalarEvolution
parent2e6dea3928c56a20a95f84e9829d3e91a078ee3e (diff)
downloadbcm5719-llvm-474112d82c7b92ea8d5ecdeaf89c9e4db34e1a4a.tar.gz
bcm5719-llvm-474112d82c7b92ea8d5ecdeaf89c9e4db34e1a4a.zip
If the step value is a constant zero, the loop isn't going to terminate. Fixes
the assert reported in PR13228! llvm-svn: 159393
Diffstat (limited to 'llvm/test/Analysis/ScalarEvolution')
-rw-r--r--llvm/test/Analysis/ScalarEvolution/how-far-to-zero.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/Analysis/ScalarEvolution/how-far-to-zero.ll b/llvm/test/Analysis/ScalarEvolution/how-far-to-zero.ll
new file mode 100644
index 00000000000..07af88ffbeb
--- /dev/null
+++ b/llvm/test/Analysis/ScalarEvolution/how-far-to-zero.ll
@@ -0,0 +1,27 @@
+; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
+
+; PR13228
+define void @f() nounwind uwtable readnone {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.cond, %entry
+ %c.0 = phi i8 [ 1, %entry ], [ 0, %for.cond ]
+ %i.0 = phi i8 [ 0, %entry ], [ %inc, %for.cond ]
+ %lnot = icmp eq i8 %i.0, 0
+ %inc = add i8 %i.0, 1
+ br i1 %lnot, label %for.cond, label %while.cond
+
+while.cond: ; preds = %while.body, %for.cond
+ %b.2 = phi i8 [ %add, %while.body ], [ 0, %for.cond ]
+ br i1 undef, label %while.end, label %while.body
+
+while.body: ; preds = %while.cond
+ %add = add i8 %b.2, %c.0
+ %tobool7 = icmp eq i8 %add, 0
+ br i1 %tobool7, label %while.end, label %while.cond
+
+while.end: ; preds = %while.body, %while.cond
+ ret void
+}
+;CHECK: Loop %while.cond: <multiple exits> Unpredictable backedge-taken count.
OpenPOWER on IntegriCloud