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