diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-05-01 04:03:01 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-05-01 04:03:01 +0000 |
commit | 4056a73638d3019cbd153679361411d5595f50c9 (patch) | |
tree | 2e468da0a3b3f7e2faa3007233382f62101d7333 /test/Transforms | |
parent | 973f72a29aeafb1fdc4f8dafc3f6c6651cbb0c99 (diff) | |
download | external_llvm-4056a73638d3019cbd153679361411d5595f50c9.zip external_llvm-4056a73638d3019cbd153679361411d5595f50c9.tar.gz external_llvm-4056a73638d3019cbd153679361411d5595f50c9.tar.bz2 |
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')
-rw-r--r-- | test/Transforms/LICM/speculate.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Transforms/LICM/speculate.ll b/test/Transforms/LICM/speculate.ll index 507b193..4c4d036 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 +} |