1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=inline -S < %s | FileCheck %s
3 target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
6 ; This callee uses scoped alias metadata internally itself.
7 define void @callee_with_metadata(ptr nocapture %a, ptr nocapture %b, ptr nocapture readonly %c) #0 {
8 ; CHECK-LABEL: @callee_with_metadata(
10 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META0:![0-9]+]])
11 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META3:![0-9]+]])
12 ; CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[C:%.*]], align 4, !noalias !5
13 ; CHECK-NEXT: [[ARRAYIDX_I:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 5
14 ; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX_I]], align 4, !alias.scope !0, !noalias !3
15 ; CHECK-NEXT: [[ARRAYIDX1_I:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 8
16 ; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX1_I]], align 4, !alias.scope !3, !noalias !0
17 ; CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[C]], align 4
18 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[A]], i64 7
19 ; CHECK-NEXT: store float [[TMP1]], ptr [[ARRAYIDX]], align 4
20 ; CHECK-NEXT: ret void
23 call void @llvm.experimental.noalias.scope.decl(metadata !7)
24 call void @llvm.experimental.noalias.scope.decl(metadata !8)
25 %0 = load float, ptr %c, align 4, !noalias !3
26 %arrayidx.i = getelementptr inbounds float, ptr %a, i64 5
27 store float %0, ptr %arrayidx.i, align 4, !alias.scope !7, !noalias !8
28 %arrayidx1.i = getelementptr inbounds float, ptr %b, i64 8
29 store float %0, ptr %arrayidx1.i, align 4, !alias.scope !8, !noalias !7
30 %1 = load float, ptr %c, align 4
31 %arrayidx = getelementptr inbounds float, ptr %a, i64 7
32 store float %1, ptr %arrayidx, align 4
36 declare void @llvm.experimental.noalias.scope.decl(metadata);
38 ; This callee does not make use of scoped alias metadata itself.
39 define void @callee_without_metadata(ptr nocapture %a, ptr nocapture %b, ptr nocapture readonly %c) #0 {
40 ; CHECK-LABEL: @callee_without_metadata(
42 ; CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[C:%.*]], align 4
43 ; CHECK-NEXT: [[ARRAYIDX_I:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 5
44 ; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX_I]], align 4
45 ; CHECK-NEXT: [[ARRAYIDX1_I:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 8
46 ; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX1_I]], align 4
47 ; CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[C]], align 4
48 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[A]], i64 7
49 ; CHECK-NEXT: store float [[TMP1]], ptr [[ARRAYIDX]], align 4
50 ; CHECK-NEXT: ret void
53 %0 = load float, ptr %c, align 4
54 %arrayidx.i = getelementptr inbounds float, ptr %a, i64 5
55 store float %0, ptr %arrayidx.i, align 4
56 %arrayidx1.i = getelementptr inbounds float, ptr %b, i64 8
57 store float %0, ptr %arrayidx1.i, align 4
58 %1 = load float, ptr %c, align 4
59 %arrayidx = getelementptr inbounds float, ptr %a, i64 7
60 store float %1, ptr %arrayidx, align 4
64 define void @caller(ptr nocapture %a, ptr nocapture %b, ptr nocapture readonly %c_ptr) #0 {
65 ; CHECK-LABEL: @caller(
67 ; CHECK-NEXT: [[C:%.*]] = load ptr, ptr [[C_PTR:%.*]], align 8, !alias.scope !6
68 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META9:![0-9]+]]), !noalias !6
69 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META12:![0-9]+]]), !noalias !6
70 ; CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[C]], align 4, !noalias !14
71 ; CHECK-NEXT: [[ARRAYIDX_I_I:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 5
72 ; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX_I_I]], align 4, !alias.scope !9, !noalias !15
73 ; CHECK-NEXT: [[ARRAYIDX1_I_I:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 8
74 ; CHECK-NEXT: store float [[TMP0]], ptr [[ARRAYIDX1_I_I]], align 4, !alias.scope !12, !noalias !16
75 ; CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[C]], align 4, !noalias !6
76 ; CHECK-NEXT: [[ARRAYIDX_I:%.*]] = getelementptr inbounds float, ptr [[A]], i64 7
77 ; CHECK-NEXT: store float [[TMP1]], ptr [[ARRAYIDX_I]], align 4, !noalias !6
78 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META17:![0-9]+]]), !alias.scope !6
79 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META20:![0-9]+]]), !alias.scope !6
80 ; CHECK-NEXT: [[TMP2:%.*]] = load float, ptr [[A]], align 4, !alias.scope !6, !noalias !22
81 ; CHECK-NEXT: [[ARRAYIDX_I_I1:%.*]] = getelementptr inbounds float, ptr [[B]], i64 5
82 ; CHECK-NEXT: store float [[TMP2]], ptr [[ARRAYIDX_I_I1]], align 4, !alias.scope !23, !noalias !20
83 ; CHECK-NEXT: [[ARRAYIDX1_I_I2:%.*]] = getelementptr inbounds float, ptr [[B]], i64 8
84 ; CHECK-NEXT: store float [[TMP2]], ptr [[ARRAYIDX1_I_I2]], align 4, !alias.scope !24, !noalias !17
85 ; CHECK-NEXT: [[TMP3:%.*]] = load float, ptr [[A]], align 4, !alias.scope !6
86 ; CHECK-NEXT: [[ARRAYIDX_I3:%.*]] = getelementptr inbounds float, ptr [[B]], i64 7
87 ; CHECK-NEXT: store float [[TMP3]], ptr [[ARRAYIDX_I3]], align 4, !alias.scope !6
88 ; CHECK-NEXT: [[TMP4:%.*]] = load float, ptr [[C]], align 4, !noalias !6
89 ; CHECK-NEXT: [[ARRAYIDX_I_I4:%.*]] = getelementptr inbounds float, ptr [[A]], i64 5
90 ; CHECK-NEXT: store float [[TMP4]], ptr [[ARRAYIDX_I_I4]], align 4, !noalias !6
91 ; CHECK-NEXT: [[ARRAYIDX1_I_I5:%.*]] = getelementptr inbounds float, ptr [[B]], i64 8
92 ; CHECK-NEXT: store float [[TMP4]], ptr [[ARRAYIDX1_I_I5]], align 4, !noalias !6
93 ; CHECK-NEXT: [[TMP5:%.*]] = load float, ptr [[C]], align 4, !noalias !6
94 ; CHECK-NEXT: [[ARRAYIDX_I6:%.*]] = getelementptr inbounds float, ptr [[A]], i64 7
95 ; CHECK-NEXT: store float [[TMP5]], ptr [[ARRAYIDX_I6]], align 4, !noalias !6
96 ; CHECK-NEXT: [[TMP6:%.*]] = load float, ptr [[A]], align 4, !alias.scope !6
97 ; CHECK-NEXT: [[ARRAYIDX_I_I7:%.*]] = getelementptr inbounds float, ptr [[B]], i64 5
98 ; CHECK-NEXT: store float [[TMP6]], ptr [[ARRAYIDX_I_I7]], align 4, !alias.scope !6
99 ; CHECK-NEXT: [[ARRAYIDX1_I_I8:%.*]] = getelementptr inbounds float, ptr [[B]], i64 8
100 ; CHECK-NEXT: store float [[TMP6]], ptr [[ARRAYIDX1_I_I8]], align 4, !alias.scope !6
101 ; CHECK-NEXT: [[TMP7:%.*]] = load float, ptr [[A]], align 4, !alias.scope !6
102 ; CHECK-NEXT: [[ARRAYIDX_I9:%.*]] = getelementptr inbounds float, ptr [[B]], i64 7
103 ; CHECK-NEXT: store float [[TMP7]], ptr [[ARRAYIDX_I9]], align 4, !alias.scope !6
104 ; CHECK-NEXT: ret void
107 %c = load ptr, ptr %c_ptr, !alias.scope !0
108 call void @callee_with_metadata(ptr %a, ptr %b, ptr %c), !noalias !0
109 call void @callee_with_metadata(ptr %b, ptr %b, ptr %a), !alias.scope !0
110 call void @callee_without_metadata(ptr %a, ptr %b, ptr %c), !noalias !0
111 call void @callee_without_metadata(ptr %b, ptr %b, ptr %a), !alias.scope !0
115 attributes #0 = { nounwind uwtable }
118 !1 = distinct !{!1, !2, !"hello: %a"}
119 !2 = distinct !{!2, !"hello"}
121 !4 = distinct !{!4, !5, !"hello2: %a"}
122 !5 = distinct !{!5, !"hello2"}
123 !6 = distinct !{!6, !5, !"hello2: %b"}
128 ; CHECK: !1 = distinct !{!1, !2, !"hello2: %a"}
129 ; CHECK: !2 = distinct !{!2, !"hello2"}
131 ; CHECK: !4 = distinct !{!4, !2, !"hello2: %b"}
132 ; CHECK: !5 = !{!1, !4}
134 ; CHECK: !7 = distinct !{!7, !8, !"hello: %a"}
135 ; CHECK: !8 = distinct !{!8, !"hello"}
137 ; CHECK: !10 = distinct !{!10, !11, !"hello2: %a"}
138 ; CHECK: !11 = distinct !{!11, !"hello2"}
139 ; CHECK: !12 = !{!13}
140 ; CHECK: !13 = distinct !{!13, !11, !"hello2: %b"}
141 ; CHECK: !14 = !{!10, !13, !7}
142 ; CHECK: !15 = !{!13, !7}
143 ; CHECK: !16 = !{!10, !7}
144 ; CHECK: !17 = !{!18}
145 ; CHECK: !18 = distinct !{!18, !19, !"hello2: %a"}
146 ; CHECK: !19 = distinct !{!19, !"hello2"}
147 ; CHECK: !20 = !{!21}
148 ; CHECK: !21 = distinct !{!21, !19, !"hello2: %b"}
149 ; CHECK: !22 = !{!18, !21}
150 ; CHECK: !23 = !{!18, !7}
151 ; CHECK: !24 = !{!21, !7}