aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/IndVarSimplify
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-06-29 23:03:57 +0000
committerAndrew Trick <atrick@apple.com>2011-06-29 23:03:57 +0000
commitcc359d9fa28a871b18d93da76fd9cf516499e39f (patch)
tree37c38773dc06da81d6960e370ff549992af2f061 /test/Transforms/IndVarSimplify
parent3290239daff266dce1051dfd103106956e05a7b1 (diff)
downloadexternal_llvm-cc359d9fa28a871b18d93da76fd9cf516499e39f.zip
external_llvm-cc359d9fa28a871b18d93da76fd9cf516499e39f.tar.gz
external_llvm-cc359d9fa28a871b18d93da76fd9cf516499e39f.tar.bz2
indvars -disable-iv-rewrite: insert new trunc instructions carefully.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134112 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/IndVarSimplify')
-rw-r--r--test/Transforms/IndVarSimplify/no-iv-rewrite.ll33
1 files changed, 31 insertions, 2 deletions
diff --git a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
index 462ff58..3395be2 100644
--- a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
+++ b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
@@ -153,8 +153,37 @@ loop:
br i1 %cond, label %loop, label %exit
exit:
- br label %return
+ ret void
+}
-return:
+define void @maxvisitor(i32 %limit, i32* %base) nounwind {
+entry: br label %loop
+
+; CHECK: loop:
+; CHECK: phi i64
+; CHECK: trunc
+; CHECK: exit
+loop:
+ %idx = phi i32 [ 0, %entry ], [ %idx.next, %loop.inc ]
+ %max = phi i32 [ 0, %entry ], [ %max.next, %loop.inc ]
+ %idxprom = sext i32 %idx to i64
+ %adr = getelementptr inbounds i32* %base, i64 %idxprom
+ %val = load i32* %adr
+ %cmp19 = icmp sgt i32 %val, %max
+ br i1 %cmp19, label %if.then, label %if.else
+
+if.then:
+ br label %loop.inc
+
+if.else:
+ br label %loop.inc
+
+loop.inc:
+ %max.next = phi i32 [ %idx, %if.then ], [ %max, %if.else ]
+ %idx.next = add nsw i32 %idx, 1
+ %cmp = icmp slt i32 %idx.next, %limit
+ br i1 %cmp, label %loop, label %exit
+
+exit:
ret void
} \ No newline at end of file