diff options
| author | Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> | 2008-02-11 18:37:34 +0000 |
|---|---|---|
| committer | Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> | 2008-02-11 18:37:34 +0000 |
| commit | adae053b5365b6a7f92682e306c410f2e129a24d (patch) | |
| tree | 0f6141c3c1274da0aad2a731e3a1220659e705d4 /llvm/test | |
| parent | 6f30a0798ffad09b845c03d6da988e72d90237b8 (diff) | |
| download | bcm5719-llvm-adae053b5365b6a7f92682e306c410f2e129a24d.tar.gz bcm5719-llvm-adae053b5365b6a7f92682e306c410f2e129a24d.zip | |
If the LHS of the comparison is a loop-invariant we also want to move it
to the RHS. This simple change allows to compute loop iteration count
for loops with condition similar to the one in the testcase (which seems
to be quite common).
llvm-svn: 46959
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll b/llvm/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll new file mode 100644 index 00000000000..3cdb1e3c768 --- /dev/null +++ b/llvm/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | opt -scalar-evolution -analyze | not grep Unpredictable + +define void @foo(i32 %n) { +entry: + br label %header +header: + %i = phi i32 [ 0, %entry ], [ %i.inc, %next ] + %cond = icmp sgt i32 %n, %i + br i1 %cond, label %next, label %return +next: + %i.inc = add i32 %i, 1 + br label %header +return: + ret void +} |

