1 ; RUN: opt -indvars -S < %s | FileCheck %s
3 ; indvars should transform the phi node pair from the for-loop
5 ; CHECK: ret = phi i32 [ 0, %entry ], [ 0, {{.*}} ]
7 @c = common global i32 0, align 4
9 define i32 @main() #0 {
11 %0 = load i32, i32* @c, align 4
12 %tobool = icmp eq i32 %0, 0
13 br i1 %tobool, label %for.body, label %exit
16 %inc2 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
17 %sub = add i32 %inc2, -1
18 %cmp1 = icmp uge i32 %sub, %inc2
19 %conv = zext i1 %cmp1 to i32
23 %inc = add nsw i32 %inc2, 1
24 %cmp = icmp slt i32 %inc, 5
25 br i1 %cmp, label %for.body, label %exit
28 %ret = phi i32 [ 0, %entry ], [ %conv, %for.inc ]