1 ; RUN: opt -aa-pipeline=tbaa -passes=licm -S < %s | FileCheck %s
3 ; LICM should be able to hoist the address load out of the loop
4 ; by using TBAA information.
8 ; CHECK-NEXT: %tmp3 = load ptr, ptr @P
9 ; CHECK-NEXT: br label %for.body
11 @P = common global ptr null
13 define void @foo(i64 %n) nounwind {
17 for.body: ; preds = %entry, %for.body
18 %i.07 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
19 %tmp3 = load ptr, ptr @P, !tbaa !1
20 %scevgep = getelementptr double, ptr %tmp3, i64 %i.07
21 %tmp4 = load double, ptr %scevgep, !tbaa !2
22 %mul = fmul double %tmp4, 2.300000e+00
23 store double %mul, ptr %scevgep, !tbaa !2
24 %inc = add i64 %i.07, 1
25 %exitcond = icmp eq i64 %inc, %n
26 br i1 %exitcond, label %for.end, label %for.body
28 for.end: ; preds = %for.body, %entry
36 ; LICM shouldn't hoist anything here.
44 ; CHECK: br label %loop
46 define void @bar(ptr %p) nounwind {
51 %tmp51 = load ptr, ptr %p, !tbaa !4
52 store ptr %tmp51, ptr %p
53 %tmp40 = load i8, ptr %p, !tbaa !5
54 store i8 %tmp40, ptr %p
58 !3 = !{!"pointer", !8}
60 !5 = !{!10, !10, i64 0}
61 !6 = !{!"pointer", !0}
65 !10 = !{!"scalar-type", !9}