1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -passes=mldst-motion -S %s | FileCheck %s
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
define void @perserve_common_metadata(i1 %c, ptr %dst, ptr %min) {
; CHECK-LABEL: define void @perserve_common_metadata(
; CHECK-SAME: i1 [[C:%.*]], ptr [[DST:%.*]], ptr [[MIN:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[GEP_DST_16:%.*]] = getelementptr inbounds nuw i8, ptr [[DST]], i64 16
; CHECK-NEXT: br i1 [[C]], label %[[THEN:.*]], label %[[ELSE:.*]]
; CHECK: [[THEN]]:
; CHECK-NEXT: store ptr [[DST]], ptr [[MIN]], align 8, !tbaa [[TBAA0:![0-9]+]]
; CHECK-NEXT: br label %[[RETURN:.*]]
; CHECK: [[ELSE]]:
; CHECK-NEXT: [[GEP_DST_24:%.*]] = getelementptr inbounds nuw i8, ptr [[DST]], i64 24
; CHECK-NEXT: store ptr null, ptr [[GEP_DST_24]], align 8
; CHECK-NEXT: br label %[[RETURN]]
; CHECK: [[RETURN]]:
; CHECK-NEXT: [[DOTSINK:%.*]] = phi ptr [ [[DST]], %[[THEN]] ], [ null, %[[ELSE]] ]
; CHECK-NEXT: store ptr [[DOTSINK]], ptr [[GEP_DST_16]], align 8, !tbaa [[TBAA4:![0-9]+]], !alias.scope [[META6:![0-9]+]], !noalias [[META6]], !llvm.access.group [[ACC_GRP9:![0-9]+]]
; CHECK-NEXT: ret void
;
entry:
%gep.dst.16 = getelementptr inbounds nuw i8, ptr %dst, i64 16
br i1 %c, label %then, label %else
then:
store ptr %dst, ptr %gep.dst.16, align 8, !tbaa !0, !alias.scope !9, !noalias !9, !llvm.access.group !13
store ptr %dst, ptr %min, align 8, !tbaa !5
br label %return
else:
store ptr null, ptr %gep.dst.16, align 8, !tbaa !0, !alias.scope !9, !noalias !9, !llvm.access.group !13
%gep.dst.24 = getelementptr inbounds nuw i8, ptr %dst, i64 24
store ptr null, ptr %gep.dst.24, align 8
br label %return
return:
ret void
}
define void @clear_different_metadata(i1 %c, ptr %dst, ptr %min) {
; CHECK-LABEL: define void @clear_different_metadata(
; CHECK-SAME: i1 [[C:%.*]], ptr [[DST:%.*]], ptr [[MIN:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[GEP_DST_16:%.*]] = getelementptr inbounds nuw i8, ptr [[DST]], i64 16
; CHECK-NEXT: br i1 [[C]], label %[[THEN:.*]], label %[[ELSE:.*]]
; CHECK: [[THEN]]:
; CHECK-NEXT: store ptr [[DST]], ptr [[MIN]], align 8, !tbaa [[TBAA10:![0-9]+]]
; CHECK-NEXT: br label %[[RETURN:.*]]
; CHECK: [[ELSE]]:
; CHECK-NEXT: [[GEP_DST_24:%.*]] = getelementptr inbounds nuw i8, ptr [[DST]], i64 24
; CHECK-NEXT: store ptr null, ptr [[GEP_DST_24]], align 8
; CHECK-NEXT: br label %[[RETURN]]
; CHECK: [[RETURN]]:
; CHECK-NEXT: [[DOTSINK:%.*]] = phi ptr [ [[DST]], %[[THEN]] ], [ null, %[[ELSE]] ]
; CHECK-NEXT: store ptr [[DOTSINK]], ptr [[GEP_DST_16]], align 8
; CHECK-NEXT: ret void
;
entry:
%gep.dst.16 = getelementptr inbounds nuw i8, ptr %dst, i64 16
br i1 %c, label %then, label %else
then:
store ptr %dst, ptr %gep.dst.16, align 8, !tbaa !5, !alias.scope !9, !noalias !9, !llvm.access.group !13
store ptr %dst, ptr %min, align 8, !tbaa !6
br label %return
else:
store ptr null, ptr %gep.dst.16, align 8, !tbaa !6, !alias.scope !12, !noalias !12, !llvm.access.group !14
%gep.dst.24 = getelementptr inbounds nuw i8, ptr %dst, i64 24
store ptr null, ptr %gep.dst.24, align 8
br label %return
return:
ret void
}
!0 = !{!1, !1, i64 0, i64 0}
!1 = !{!"long", !2}
!2 = !{!"omnipotent char", !3, i64 0}
!3 = !{!"Simple C++ TBAA"}
!4 = !{!5, !5, i64 0, i64 0}
!5 = !{!"int", !2}
!6 = !{!7, !7, i64 0, i64 0}
!7 = !{!"p2 _Foo", !8}
!8 = !{!"any pointer", !2, i64 0}
!9 = !{!10}
!10 = distinct !{!10, !11}
!11 = distinct !{!11}
!12 = distinct !{!10}
!13 = distinct !{}
!14 = distinct !{}
;.
; CHECK: [[TBAA0]] = !{[[META1:![0-9]+]], [[META1]], i64 0}
; CHECK: [[META1]] = !{!"int", [[META2:![0-9]+]]}
; CHECK: [[META2]] = !{!"omnipotent char", [[META3:![0-9]+]], i64 0}
; CHECK: [[META3]] = !{!"Simple C++ TBAA"}
; CHECK: [[TBAA4]] = !{[[META5:![0-9]+]], [[META5]], i64 0, i64 0}
; CHECK: [[META5]] = !{!"long", [[META2]]}
; CHECK: [[META6]] = !{[[META7:![0-9]+]]}
; CHECK: [[META7]] = distinct !{[[META7]], [[META8:![0-9]+]]}
; CHECK: [[META8]] = distinct !{[[META8]]}
; CHECK: [[ACC_GRP9]] = distinct !{}
; CHECK: [[TBAA10]] = !{[[META11:![0-9]+]], [[META11]], i64 0, i64 0}
; CHECK: [[META11]] = !{!"p2 _Foo", [[META12:![0-9]+]]}
; CHECK: [[META12]] = !{!"any pointer", [[META2]], i64 0}
;.
|