1 ; RUN: opt < %s -loop-reduce -S | FileCheck %s
3 ; Provide legal integer types.
4 target datalayout = "n8:16:32:64"
6 @d = common global i32 0, align 4
8 define void @fn2(i32 %x) nounwind uwtable {
13 %g.0 = phi i32 [ 0, %entry ], [ %dec, %for.cond ]
14 %tobool = icmp eq i32 %x, 0
15 %dec = add nsw i32 %g.0, -1
16 br i1 %tobool, label %for.cond, label %for.end
19 ; CHECK: %tmp1 = load i32, i32* @d, align 4
20 ; CHECK-NEXT: %tmp2 = load i32, i32* @d, align 4
21 ; CHECK-NEXT: %0 = sub i32 %tmp1, %tmp2
23 %tmp1 = load i32, i32* @d, align 4
24 %add = add nsw i32 %tmp1, %g.0
25 %tmp2 = load i32, i32* @d, align 4
26 %tobool26 = icmp eq i32 %x, 0
27 br i1 %tobool26, label %for.end5, label %for.body.lr.ph
30 %tobool3 = icmp ne i32 %tmp2, %add