summaryrefslogtreecommitdiff
path: root/test/Transforms/LICM/speculate.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-05-01 04:03:01 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-05-01 04:03:01 +0000
commit4056a73638d3019cbd153679361411d5595f50c9 (patch)
tree2e468da0a3b3f7e2faa3007233382f62101d7333 /test/Transforms/LICM/speculate.ll
parent973f72a29aeafb1fdc4f8dafc3f6c6651cbb0c99 (diff)
downloadllvm-4056a73638d3019cbd153679361411d5595f50c9.tar.gz
llvm-4056a73638d3019cbd153679361411d5595f50c9.tar.bz2
llvm-4056a73638d3019cbd153679361411d5595f50c9.tar.xz
An instruction in a loop is not guaranteed to be executed just because the loop
has no exit blocks. Fixes PR12706! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155884 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LICM/speculate.ll')
-rw-r--r--test/Transforms/LICM/speculate.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Transforms/LICM/speculate.ll b/test/Transforms/LICM/speculate.ll
index 507b193e6b..4c4d036b7d 100644
--- a/test/Transforms/LICM/speculate.ll
+++ b/test/Transforms/LICM/speculate.ll
@@ -165,3 +165,25 @@ for.inc: ; preds = %if.then, %for.body
for.end: ; preds = %for.inc, %entry
ret void
}
+
+; SDiv is unsafe to speculate inside an infinite loop.
+
+define void @unsafe_sdiv_c(i64 %a, i64 %b, i64* %p) {
+entry:
+; CHECK: entry:
+; CHECK-NOT: sdiv
+; CHECK: br label %for.body
+ br label %for.body
+
+for.body:
+ %c = icmp eq i64 %b, 0
+ br i1 %c, label %backedge, label %if.then
+
+if.then:
+ %d = sdiv i64 %a, %b
+ store i64 %d, i64* %p
+ br label %backedge
+
+backedge:
+ br label %for.body
+}