1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt < %s -passes=licm -S | FileCheck %s
5 @g_58 = common global i32 0, align 4
6 @g_116 = common global ptr null, align 8
9 ; CHECK-LABEL: define void @f() {
11 ; CHECK-NEXT: [[L_87_I:%.*]] = alloca [9 x i16], align 16
12 ; CHECK-NEXT: [[G_58_PROMOTED:%.*]] = load i32, ptr @g_58, align 4, !tbaa [[TBAA0:![0-9]+]]
13 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
15 ; CHECK-NEXT: [[TMP31:%.*]] = phi i32 [ [[G_58_PROMOTED]], [[ENTRY:%.*]] ], [ [[OR:%.*]], [[FOR_BODY]] ]
16 ; CHECK-NEXT: [[INC12:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
17 ; CHECK-NEXT: [[OR]] = or i32 [[TMP31]], 10
18 ; CHECK-NEXT: [[INC]] = add nsw i32 [[INC12]], 1
19 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], 4
20 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]]
22 ; CHECK-NEXT: [[OR_LCSSA:%.*]] = phi i32 [ [[OR]], [[FOR_BODY]] ]
23 ; CHECK-NEXT: store ptr @g_58, ptr @g_116, align 8, !tbaa [[TBAA4:![0-9]+]]
24 ; CHECK-NEXT: store i32 [[OR_LCSSA]], ptr @g_58, align 4, !tbaa [[TBAA0]]
25 ; CHECK-NEXT: ret void
29 %l_87.i = alloca [9 x i16], align 16
32 for.body: ; preds = %entry, %for.inc
33 %inc12 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
34 store ptr @g_58, ptr @g_116, align 8, !tbaa !0
35 %tmp2 = load ptr, ptr @g_116, align 8, !tbaa !0
36 %tmp3 = load i32, ptr %tmp2, !tbaa !4
37 %or = or i32 %tmp3, 10
38 store i32 %or, ptr %tmp2, !tbaa !4
39 %inc = add nsw i32 %inc12, 1
40 %cmp = icmp slt i32 %inc, 4
41 br i1 %cmp, label %for.body, label %for.end
43 for.end: ; preds = %for.inc
48 !1 = !{!"omnipotent char", !2}
49 !2 = !{!"Simple C/C++ TBAA"}
52 !5 = !{!"any pointer", !1}