1 ; RUN: opt -irce -S < %s
3 ; These test cases don't check the correctness of the transform, but
4 ; that the -irce does not crash in the presence of certain things in
7 define void @mismatched_types_1() {
8 ; In this test case, the safe range for the only range check in the
9 ; loop is of type [i32, i32) while the backedge taken count is of type
12 ; CHECK-LABEL: mismatched_types_1
17 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ]
18 %0 = trunc i64 %indvars.iv to i32
19 %1 = icmp ult i32 %0, 7
20 br i1 %1, label %switch.lookup, label %for.inc
26 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
27 %cmp55 = icmp slt i64 %indvars.iv.next, 11
28 br i1 %cmp55, label %for.body, label %for.end
34 define void @mismatched_types_2() {
35 ; In this test case, there are two range check in the loop, one with a
36 ; safe range of type [i32, i32) and one with a safe range of type
39 ; CHECK-LABEL: mismatched_types_2
44 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ]
45 %cond.a = icmp ult i64 %indvars.iv, 7
46 br i1 %cond.a, label %switch.lookup.a, label %for.body.b
52 %truncated = trunc i64 %indvars.iv to i32
53 %cond.b = icmp ult i32 %truncated, 7
54 br i1 %cond.b, label %switch.lookup.b, label %for.inc
60 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
61 %cmp55 = icmp slt i64 %indvars.iv.next, 11
62 br i1 %cmp55, label %for.body.a, label %for.end