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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=inline -S < %s | FileCheck %s
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; This callee uses scoped alias metadata internally itself.
define void @callee_with_metadata(ptr nocapture %a, ptr nocapture %b, ptr nocapture readonly %c) #0 {
; CHECK-LABEL: @callee_with_metadata(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META0:![0-9]+]])
; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META3:![0-9]+]])
; CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[C:%.*]], align 4, !noalias !5
; CHECK-NEXT: [[ARRAYIDX_I:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 5
; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX_I]], align 4, !alias.scope !0, !noalias !3
; CHECK-NEXT: [[ARRAYIDX1_I:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 8
; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX1_I]], align 4, !alias.scope !3, !noalias !0
; CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[C]], align 4
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[A]], i64 7
; CHECK-NEXT: store float [[TMP1]], ptr [[ARRAYIDX]], align 4
; CHECK-NEXT: ret void
;
entry:
call void @llvm.experimental.noalias.scope.decl(metadata !7)
call void @llvm.experimental.noalias.scope.decl(metadata !8)
%0 = load float, ptr %c, align 4, !noalias !3
%arrayidx.i = getelementptr inbounds float, ptr %a, i64 5
store float %0, ptr %arrayidx.i, align 4, !alias.scope !7, !noalias !8
%arrayidx1.i = getelementptr inbounds float, ptr %b, i64 8
store float %0, ptr %arrayidx1.i, align 4, !alias.scope !8, !noalias !7
%1 = load float, ptr %c, align 4
%arrayidx = getelementptr inbounds float, ptr %a, i64 7
store float %1, ptr %arrayidx, align 4
ret void
}
declare void @llvm.experimental.noalias.scope.decl(metadata);
; This callee does not make use of scoped alias metadata itself.
define void @callee_without_metadata(ptr nocapture %a, ptr nocapture %b, ptr nocapture readonly %c) #0 {
; CHECK-LABEL: @callee_without_metadata(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[C:%.*]], align 4
; CHECK-NEXT: [[ARRAYIDX_I:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 5
; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX_I]], align 4
; CHECK-NEXT: [[ARRAYIDX1_I:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 8
; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX1_I]], align 4
; CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[C]], align 4
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[A]], i64 7
; CHECK-NEXT: store float [[TMP1]], ptr [[ARRAYIDX]], align 4
; CHECK-NEXT: ret void
;
entry:
%0 = load float, ptr %c, align 4
%arrayidx.i = getelementptr inbounds float, ptr %a, i64 5
store float %0, ptr %arrayidx.i, align 4
%arrayidx1.i = getelementptr inbounds float, ptr %b, i64 8
store float %0, ptr %arrayidx1.i, align 4
%1 = load float, ptr %c, align 4
%arrayidx = getelementptr inbounds float, ptr %a, i64 7
store float %1, ptr %arrayidx, align 4
ret void
}
define void @caller(ptr nocapture %a, ptr nocapture %b, ptr nocapture readonly %c_ptr) #0 {
; CHECK-LABEL: @caller(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[C:%.*]] = load ptr, ptr [[C_PTR:%.*]], align 8, !alias.scope !6
; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META9:![0-9]+]]), !noalias !6
; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META12:![0-9]+]]), !noalias !6
; CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[C]], align 4, !noalias !14
; CHECK-NEXT: [[ARRAYIDX_I_I:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 5
; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX_I_I]], align 4, !alias.scope !9, !noalias !15
; CHECK-NEXT: [[ARRAYIDX1_I_I:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 8
; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX1_I_I]], align 4, !alias.scope !12, !noalias !16
; CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[C]], align 4, !noalias !6
; CHECK-NEXT: [[ARRAYIDX_I:%.*]] = getelementptr inbounds float, ptr [[A]], i64 7
; CHECK-NEXT: store float [[TMP1]], ptr [[ARRAYIDX_I]], align 4, !noalias !6
; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META17:![0-9]+]]), !alias.scope !6
; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META20:![0-9]+]]), !alias.scope !6
; CHECK-NEXT: [[TMP2:%.*]] = load float, ptr [[A]], align 4, !alias.scope !6, !noalias !22
; CHECK-NEXT: [[ARRAYIDX_I_I1:%.*]] = getelementptr inbounds float, ptr [[B]], i64 5
; CHECK-NEXT: store float [[TMP2]], ptr [[ARRAYIDX_I_I1]], align 4, !alias.scope !23, !noalias !20
; CHECK-NEXT: [[ARRAYIDX1_I_I2:%.*]] = getelementptr inbounds float, ptr [[B]], i64 8
; CHECK-NEXT: store float [[TMP2]], ptr [[ARRAYIDX1_I_I2]], align 4, !alias.scope !24, !noalias !17
; CHECK-NEXT: [[TMP3:%.*]] = load float, ptr [[A]], align 4, !alias.scope !6
; CHECK-NEXT: [[ARRAYIDX_I3:%.*]] = getelementptr inbounds float, ptr [[B]], i64 7
; CHECK-NEXT: store float [[TMP3]], ptr [[ARRAYIDX_I3]], align 4, !alias.scope !6
; CHECK-NEXT: [[TMP4:%.*]] = load float, ptr [[C]], align 4, !noalias !6
; CHECK-NEXT: [[ARRAYIDX_I_I4:%.*]] = getelementptr inbounds float, ptr [[A]], i64 5
; CHECK-NEXT: store float [[TMP4]], ptr [[ARRAYIDX_I_I4]], align 4, !noalias !6
; CHECK-NEXT: [[ARRAYIDX1_I_I5:%.*]] = getelementptr inbounds float, ptr [[B]], i64 8
; CHECK-NEXT: store float [[TMP4]], ptr [[ARRAYIDX1_I_I5]], align 4, !noalias !6
; CHECK-NEXT: [[TMP5:%.*]] = load float, ptr [[C]], align 4, !noalias !6
; CHECK-NEXT: [[ARRAYIDX_I6:%.*]] = getelementptr inbounds float, ptr [[A]], i64 7
; CHECK-NEXT: store float [[TMP5]], ptr [[ARRAYIDX_I6]], align 4, !noalias !6
; CHECK-NEXT: [[TMP6:%.*]] = load float, ptr [[A]], align 4, !alias.scope !6
; CHECK-NEXT: [[ARRAYIDX_I_I7:%.*]] = getelementptr inbounds float, ptr [[B]], i64 5
; CHECK-NEXT: store float [[TMP6]], ptr [[ARRAYIDX_I_I7]], align 4, !alias.scope !6
; CHECK-NEXT: [[ARRAYIDX1_I_I8:%.*]] = getelementptr inbounds float, ptr [[B]], i64 8
; CHECK-NEXT: store float [[TMP6]], ptr [[ARRAYIDX1_I_I8]], align 4, !alias.scope !6
; CHECK-NEXT: [[TMP7:%.*]] = load float, ptr [[A]], align 4, !alias.scope !6
; CHECK-NEXT: [[ARRAYIDX_I9:%.*]] = getelementptr inbounds float, ptr [[B]], i64 7
; CHECK-NEXT: store float [[TMP7]], ptr [[ARRAYIDX_I9]], align 4, !alias.scope !6
; CHECK-NEXT: ret void
;
entry:
%c = load ptr, ptr %c_ptr, !alias.scope !0
call void @callee_with_metadata(ptr %a, ptr %b, ptr %c), !noalias !0
call void @callee_with_metadata(ptr %b, ptr %b, ptr %a), !alias.scope !0
call void @callee_without_metadata(ptr %a, ptr %b, ptr %c), !noalias !0
call void @callee_without_metadata(ptr %b, ptr %b, ptr %a), !alias.scope !0
ret void
}
attributes #0 = { nounwind uwtable }
!0 = !{!1}
!1 = distinct !{!1, !2, !"hello: %a"}
!2 = distinct !{!2, !"hello"}
!3 = !{!4, !6}
!4 = distinct !{!4, !5, !"hello2: %a"}
!5 = distinct !{!5, !"hello2"}
!6 = distinct !{!6, !5, !"hello2: %b"}
!7 = !{!4}
!8 = !{!6}
; CHECK: !0 = !{!1}
; CHECK: !1 = distinct !{!1, !2, !"hello2: %a"}
; CHECK: !2 = distinct !{!2, !"hello2"}
; CHECK: !3 = !{!4}
; CHECK: !4 = distinct !{!4, !2, !"hello2: %b"}
; CHECK: !5 = !{!1, !4}
; CHECK: !6 = !{!7}
; CHECK: !7 = distinct !{!7, !8, !"hello: %a"}
; CHECK: !8 = distinct !{!8, !"hello"}
; CHECK: !9 = !{!10}
; CHECK: !10 = distinct !{!10, !11, !"hello2: %a"}
; CHECK: !11 = distinct !{!11, !"hello2"}
; CHECK: !12 = !{!13}
; CHECK: !13 = distinct !{!13, !11, !"hello2: %b"}
; CHECK: !14 = !{!10, !13, !7}
; CHECK: !15 = !{!13, !7}
; CHECK: !16 = !{!10, !7}
; CHECK: !17 = !{!18}
; CHECK: !18 = distinct !{!18, !19, !"hello2: %a"}
; CHECK: !19 = distinct !{!19, !"hello2"}
; CHECK: !20 = !{!21}
; CHECK: !21 = distinct !{!21, !19, !"hello2: %b"}
; CHECK: !22 = !{!18, !21}
; CHECK: !23 = !{!18, !7}
; CHECK: !24 = !{!21, !7}
|