summaryrefslogtreecommitdiff
path: root/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-19 17:33:15 +0000
committerDan Gohman <gohman@apple.com>2009-06-19 17:33:15 +0000
commit958e292c7a71e9105df2d46ac15dcd1f3cfa0ee2 (patch)
treeef04fcff2b455457ee7e6dc32da5034ca155c88d /test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll
parentae60c0f78eedce7e3b5f81a46b1991de0862259b (diff)
downloadllvm-958e292c7a71e9105df2d46ac15dcd1f3cfa0ee2.tar.gz
llvm-958e292c7a71e9105df2d46ac15dcd1f3cfa0ee2.tar.bz2
llvm-958e292c7a71e9105df2d46ac15dcd1f3cfa0ee2.tar.xz
Don't (unconditionally) use getSCEVAtScope to simplify the step
expression in IVUsers, because in the case of a use of a non-linear addrec outside of a loop, this causes the addrec to be evaluated as a linear addrec. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73774 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll')
-rw-r--r--test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll b/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll
new file mode 100644
index 0000000000..d15c2dc313
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -analyze -iv-users -disable-output | grep {Stride i64 {1,+,2}<loop>:}
+
+; The value of %r is dependent on a polynomial iteration expression.
+
+define i64 @foo(i64 %n) {
+entry:
+ br label %loop
+
+loop:
+ %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %loop ]
+ %indvar.next = add i64 %indvar, 1
+ %c = icmp eq i64 %indvar.next, %n
+ br i1 %c, label %exit, label %loop
+
+exit:
+ %r = mul i64 %indvar, %indvar
+ ret i64 %r
+}