aboutsummaryrefslogtreecommitdiffstats
path: root/test/Analysis/ScalarEvolution/fold.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/ScalarEvolution/fold.ll')
-rw-r--r--test/Analysis/ScalarEvolution/fold.ll34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/Analysis/ScalarEvolution/fold.ll b/test/Analysis/ScalarEvolution/fold.ll
index 3c1b6ae..90012a3 100644
--- a/test/Analysis/ScalarEvolution/fold.ll
+++ b/test/Analysis/ScalarEvolution/fold.ll
@@ -22,3 +22,37 @@ define i8 @test3(i8 %x) {
; CHECK: (3 * %x)
ret i8 %C
}
+
+define void @test4(i32 %x) {
+entry:
+ %0 = icmp sge i32 %x, 0
+ br i1 %0, label %loop, label %exit
+loop:
+ %A = phi i32 [0, %entry], [%I, %loop]
+ %rand = icmp sgt i32 %A, 10
+ %Z = select i1 %rand, i32 %A, i32 10
+ %B = trunc i32 %Z to i16
+ %C = sext i16 %B to i30
+; CHECK: %C =
+; CHECK-NEXT: (trunc i32 (10 smax {0,+,1}<%loop>) to i30)
+ %D = sext i16 %B to i32
+; CHECK: %D =
+; CHECK-NEXT: (10 smax {0,+,1}<%loop>)
+ %E = sext i16 %B to i34
+; CHECK: %E =
+; CHECK-NEXT: (zext i32 (10 smax {0,+,1}<%loop>) to i34)
+ %F = zext i16 %B to i30
+; CHECK: %F =
+; CHECK-NEXT: (trunc i32 (10 smax {0,+,1}<%loop>) to i30
+ %G = zext i16 %B to i32
+; CHECK: %G =
+; CHECK-NEXT: (10 smax {0,+,1}<%loop>)
+ %H = zext i16 %B to i34
+; CHECK: %H =
+; CHECK-NEXT: (zext i32 (10 smax {0,+,1}<%loop>) to i34)
+ %I = add i32 %A, 1
+ %1 = icmp ne i32 %A, 20
+ br i1 %1, label %loop, label %exit
+exit:
+ ret void
+} \ No newline at end of file