1; RUN: opt -S -indvars < %s | FileCheck %s
2
3declare void @use(i1)
4
5define void @sext_condition(i8 %t) {
6; CHECK-LABEL: sext_condition
7 entry:
8  %st = sext i8 %t to i16
9  %ecmp = icmp slt i16 %st, 42
10  br i1 %ecmp, label %loop, label %exit
11
12 loop:
13; CHECK-LABEL: loop
14  %idx = phi i8 [ %t, %entry ], [ %idx.inc, %loop ]
15  %idx.inc = add i8 %idx, 1
16  %c = icmp slt i8 %idx, 42
17; CHECK: call void @use(i1 true)
18  call void @use(i1 %c)
19  %be = icmp slt i8 %idx.inc, 42
20  br i1 %be, label %loop, label %exit
21
22 exit:
23  ret void
24}
25
26define void @zext_condition(i8 %t) {
27; CHECK-LABEL: zext_condition
28 entry:
29  %st = zext i8 %t to i16
30  %ecmp = icmp ult i16 %st, 42
31  br i1 %ecmp, label %loop, label %exit
32
33 loop:
34; CHECK-LABEL: loop
35  %idx = phi i8 [ %t, %entry ], [ %idx.inc, %loop ]
36  %idx.inc = add i8 %idx, 1
37  %c = icmp ult i8 %idx, 42
38; CHECK: call void @use(i1 true)
39  call void @use(i1 %c)
40  %be = icmp ult i8 %idx.inc, 42
41  br i1 %be, label %loop, label %exit
42
43 exit:
44  ret void
45}
46