[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / Transforms / LICM / variant-aainfo.ll
blob1e2a33ec990c5ab4c20d88d15a9f91bebf0111ca
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt < %s -S -passes=licm | FileCheck %s
4 ; See https://discourse.llvm.org/t/rfc-dont-merge-memory-locations-in-aliassettracker/73336
5 ; pairwise TBAA indicates NoAlias of load/store ptr at %s with store i32 at %0
6 ; yet LICM fails to promote load/store ptr %s out of the loop
8 define void @_Z4testP1S(ptr %s) {
9 ; CHECK-LABEL: define void @_Z4testP1S(
10 ; CHECK-SAME: ptr [[S:%.*]]) {
11 ; CHECK-NEXT:  entry:
12 ; CHECK-NEXT:    [[S_PROMOTED:%.*]] = load ptr, ptr [[S]], align 4, !tbaa [[TBAA0:![0-9]+]]
13 ; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
14 ; CHECK:       for.cond.cleanup:
15 ; CHECK-NEXT:    [[ADD_PTR_I_LCSSA:%.*]] = phi ptr [ [[ADD_PTR_I:%.*]], [[FOR_BODY]] ]
16 ; CHECK-NEXT:    store ptr [[ADD_PTR_I_LCSSA]], ptr [[S]], align 4, !tbaa [[TBAA0]]
17 ; CHECK-NEXT:    ret void
18 ; CHECK:       for.body:
19 ; CHECK-NEXT:    [[ADD_PTR_I1:%.*]] = phi ptr [ [[S_PROMOTED]], [[ENTRY:%.*]] ], [ [[ADD_PTR_I]], [[FOR_BODY]] ]
20 ; CHECK-NEXT:    [[I_05:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
21 ; CHECK-NEXT:    store i32 [[I_05]], ptr [[ADD_PTR_I1]], align 4, !tbaa [[TBAA4:![0-9]+]]
22 ; CHECK-NEXT:    [[ADD_PTR_I]] = getelementptr inbounds i32, ptr [[ADD_PTR_I1]], i32 1
23 ; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_05]], 1
24 ; CHECK-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC]], 100
25 ; CHECK-NEXT:    br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]]
27 entry:
28   br label %for.body
30 for.cond.cleanup:                                 ; preds = %for.body
31   ret void
33 for.body:                                         ; preds = %entry, %for.body
34   %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
35   %0 = load ptr, ptr %s, align 4, !tbaa !0
36   store i32 %i.05, ptr %0, align 4, !tbaa !5
37   %add.ptr.i = getelementptr inbounds i32, ptr %0, i32 1
38   store ptr %add.ptr.i, ptr %s, align 4, !tbaa !7
39   %inc = add nuw nsw i32 %i.05, 1
40   %exitcond.not = icmp eq i32 %inc, 100
41   br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
44 !0 = !{!1, !2, i64 0}
45 !1 = !{!"_ZTS1S", !2, i64 0}
46 !2 = !{!"any pointer", !3, i64 0}
47 !3 = !{!"omnipotent char", !4, i64 0}
48 !4 = !{!"Simple C++ TBAA"}
49 !5 = !{!6, !6, i64 0}
50 !6 = !{!"int", !3, i64 0}
51 !7 = !{!2, !2, i64 0}
53 ; CHECK: [[TBAA0]] = !{[[META1:![0-9]+]], [[META1]], i64 0}
54 ; CHECK: [[META1]] = !{!"any pointer", [[META2:![0-9]+]], i64 0}
55 ; CHECK: [[META2]] = !{!"omnipotent char", [[META3:![0-9]+]], i64 0}
56 ; CHECK: [[META3]] = !{!"Simple C++ TBAA"}
57 ; CHECK: [[TBAA4]] = !{[[META5:![0-9]+]], [[META5]], i64 0}
58 ; CHECK: [[META5]] = !{!"int", [[META2]], i64 0}