1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=licm -S | FileCheck %s
4 @a = external constant ptr
6 define void @test(i32 %count) {
9 ; CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr @a, align 8
10 ; CHECK-NEXT: br label [[FORCOND:%.*]]
12 ; CHECK-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FORBODY:%.*]] ]
13 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[I_0]], [[COUNT:%.*]]
14 ; CHECK-NEXT: br i1 [[CMP]], label [[FORBODY]], label [[AFTERFOR:%.*]]
16 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr float, ptr [[TMP3]], i32 [[I_0]]
17 ; CHECK-NEXT: [[TMP7:%.*]] = uitofp i32 [[I_0]] to float
18 ; CHECK-NEXT: store float [[TMP7]], ptr [[ARRAYIDX]], align 4
19 ; CHECK-NEXT: [[INC]] = add i32 [[I_0]], 1
20 ; CHECK-NEXT: br label [[FORCOND]]
22 ; CHECK-NEXT: ret void
28 %i.0 = phi i32 [ 0, %entry ], [ %inc, %forbody ]
29 %cmp = icmp ult i32 %i.0, %count
30 br i1 %cmp, label %forbody, label %afterfor
33 %tmp3 = load ptr, ptr @a
34 %arrayidx = getelementptr float, ptr %tmp3, i32 %i.0
35 %tmp7 = uitofp i32 %i.0 to float
36 store float %tmp7, ptr %arrayidx
37 %inc = add i32 %i.0, 1