diff options
author | Devang Patel <dpatel@apple.com> | 2009-03-30 22:24:10 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-03-30 22:24:10 +0000 |
commit | b23c232fc8a0777145480cf3ccc58f5b61e0c277 (patch) | |
tree | eef4fa8a52f3578dfed13a41f8efbe974673470c /test | |
parent | 2048cdb08ef6ad04bd1baf52886605d455236eb7 (diff) | |
download | external_llvm-b23c232fc8a0777145480cf3ccc58f5b61e0c277.zip external_llvm-b23c232fc8a0777145480cf3ccc58f5b61e0c277.tar.gz external_llvm-b23c232fc8a0777145480cf3ccc58f5b61e0c277.tar.bz2 |
Loop Index Split can eliminate a loop if it can determin if loop body is executed only once. There was a bug in determining IV based value of the iteration for which the loop body is executed. Fix it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68071 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/LoopIndexSplit/2009-03-30-undef.ll | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll b/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll new file mode 100644 index 0000000..b34cb51 --- /dev/null +++ b/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll @@ -0,0 +1,24 @@ +; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | not grep undef +define i32 @main() { +entry: + br label %header + +header: + %r = phi i32 [ 0, %entry ], [ %r3, %skip ] + %i = phi i32 [ 0, %entry ], [ %i1, %skip ] + %i99 = add i32 %i, 99 + %cond = icmp eq i32 %i99, 3 + br i1 %cond, label %body, label %skip + +body: + br label %skip + +skip: + %r3 = phi i32 [ %r, %header ], [ 3, %body ] + %i1 = add i32 %i, 1 + %exitcond = icmp eq i32 %i1, 10 + br i1 %exitcond, label %exit, label %header + +exit: + ret i32 %r3 +} |