1 ; RUN: opt -S -loop-rotate -verify-memoryssa < %s | FileCheck %s
2 ; RUN: opt -S -passes='require<targetir>,require<assumptions>,loop(loop-rotate)' < %s | FileCheck %s
3 ; RUN: opt -S -passes='require<targetir>,require<assumptions>,loop(loop-rotate)' -verify-memoryssa < %s | FileCheck %s
5 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
10 define void @test_02(i32* nocapture %_pA) nounwind ssp {
11 ; CHECK-LABEL: @test_02(
13 ; CHECK: tail call void @llvm.experimental.noalias.scope.decl(metadata !2)
14 ; CHECK: store i32 42, i32* %_pA, align 16, !alias.scope !2
16 ; CHECK: tail call void @llvm.experimental.noalias.scope.decl(metadata !5)
17 ; CHECK: store i32 0, i32* %arrayidx, align 16, !noalias !5
18 ; CHECK: tail call void @llvm.experimental.noalias.scope.decl(metadata !7)
19 ; CHECK: store i32 42, i32* %_pA, align 16, !alias.scope !7
23 %array = alloca [20 x i32], align 16
26 for.cond: ; preds = %for.body, %entry
27 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
28 tail call void @llvm.experimental.noalias.scope.decl(metadata !2)
29 store i32 42, i32* %_pA, align 16, !alias.scope !2
30 %cmp = icmp slt i32 %i.0, 100
31 %arrayidx = getelementptr inbounds [20 x i32], [20 x i32]* %array, i64 0, i64 0
32 br i1 %cmp, label %for.body, label %for.end
34 for.body: ; preds = %for.cond
35 store i32 0, i32* %arrayidx, align 16, !noalias !2
36 %inc = add nsw i32 %i.0, 1
39 for.end: ; preds = %for.cond
40 %arrayidx.lcssa = phi i32* [ %arrayidx, %for.cond ]
41 call void @g(i32* %arrayidx.lcssa) nounwind
45 define void @test_03(i32* nocapture %_pA) nounwind ssp {
46 ; CHECK-LABEL: @test_03(
49 ; CHECK: tail call void @llvm.experimental.noalias.scope.decl(metadata !5)
50 ; CHECK: store i32 42, i32* %_pA, align 16, !alias.scope !5
51 ; CHECK: store i32 0, i32* %arrayidx, align 16, !noalias !5
55 %array = alloca [20 x i32], align 16
58 for.cond: ; preds = %for.body, %entry
59 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
60 %cmp = icmp slt i32 %i.0, 100
61 %arrayidx = getelementptr inbounds [20 x i32], [20 x i32]* %array, i64 0, i64 0
62 br i1 %cmp, label %for.body, label %for.end
64 for.body: ; preds = %for.cond
65 tail call void @llvm.experimental.noalias.scope.decl(metadata !2)
66 store i32 42, i32* %_pA, align 16, !alias.scope !2
67 store i32 0, i32* %arrayidx, align 16, !noalias !2
68 %inc = add nsw i32 %i.0, 1
71 for.end: ; preds = %for.cond
72 %arrayidx.lcssa = phi i32* [ %arrayidx, %for.cond ]
73 call void @g(i32* %arrayidx.lcssa) nounwind
77 define void @test_04(i32* nocapture %_pA) nounwind ssp {
78 ; CHECK-LABEL: @test_04(
80 ; CHECK: tail call void @llvm.experimental.noalias.scope.decl(metadata !9)
81 ; CHECK: store i32 42, i32* %_pA, align 16, !alias.scope !9
83 ; CHECK: tail call void @llvm.experimental.noalias.scope.decl(metadata !5)
84 ; CHECK: store i32 0, i32* %arrayidx, align 16, !noalias !5
85 ; CHECK: store i32 43, i32* %_pA, align 16, !alias.scope !5
86 ; CHECK: tail call void @llvm.experimental.noalias.scope.decl(metadata !11)
87 ; CHECK: store i32 42, i32* %_pA, align 16, !alias.scope !11
90 %array = alloca [20 x i32], align 16
93 for.cond: ; preds = %for.body, %entry
94 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
95 tail call void @llvm.experimental.noalias.scope.decl(metadata !2)
96 store i32 42, i32* %_pA, align 16, !alias.scope !2
97 %cmp = icmp slt i32 %i.0, 100
98 %arrayidx = getelementptr inbounds [20 x i32], [20 x i32]* %array, i64 0, i64 0
99 br i1 %cmp, label %for.body, label %for.end
101 for.body: ; preds = %for.cond
102 store i32 0, i32* %arrayidx, align 16, !noalias !2
103 store i32 43, i32* %_pA, align 16, !alias.scope !2
104 %inc = add nsw i32 %i.0, 1
107 for.end: ; preds = %for.cond
108 %arrayidx.lcssa = phi i32* [ %arrayidx, %for.cond ]
109 call void @g(i32* %arrayidx.lcssa) nounwind
113 define void @test_05(i32* nocapture %_pA) nounwind ssp {
114 ; CHECK-LABEL: @test_05(
116 ; CHECK: tail call void @llvm.experimental.noalias.scope.decl(metadata !13)
117 ; CHECK: store i32 42, i32* %_pA, align 16, !alias.scope !13
119 ; CHECK: tail call void @llvm.experimental.noalias.scope.decl(metadata !5)
120 ; CHECK: store i32 0, i32* %arrayidx, align 16, !noalias !5
121 ; CHECK: store i32 43, i32* %_pA, align 16, !alias.scope !5
122 ; CHECK: tail call void @llvm.experimental.noalias.scope.decl(metadata !15)
123 ; CHECK: store i32 42, i32* %_pA, align 16, !alias.scope !15
125 ; CHECK: store i32 44, i32* %_pA, align 16, !alias.scope !5
128 %array = alloca [20 x i32], align 16
131 for.cond: ; preds = %for.body, %entry
132 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
133 tail call void @llvm.experimental.noalias.scope.decl(metadata !2)
134 store i32 42, i32* %_pA, align 16, !alias.scope !2
135 %cmp = icmp slt i32 %i.0, 100
136 %arrayidx = getelementptr inbounds [20 x i32], [20 x i32]* %array, i64 0, i64 0
137 br i1 %cmp, label %for.body, label %for.end
139 for.body: ; preds = %for.cond
140 store i32 0, i32* %arrayidx, align 16, !noalias !2
141 store i32 43, i32* %_pA, align 16, !alias.scope !2
142 %inc = add nsw i32 %i.0, 1
145 for.end: ; preds = %for.cond
146 %arrayidx.lcssa = phi i32* [ %arrayidx, %for.cond ]
147 store i32 44, i32* %_pA, align 16, !alias.scope !2
148 call void @g(i32* %arrayidx.lcssa) nounwind
152 ; Function Attrs: inaccessiblememonly nounwind
153 declare void @llvm.experimental.noalias.scope.decl(metadata) #1
155 attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
156 attributes #1 = { inaccessiblememonly nounwind }
157 attributes #2 = { nounwind readnone speculatable }
159 !llvm.module.flags = !{!0}
162 !0 = !{i32 1, !"wchar_size", i32 4}
165 !3 = distinct !{!3, !4, !"test_loop_rotate_XX: pA"}
166 !4 = distinct !{!4, !"test_loop_rotate_XX"}
168 ; CHECK: !0 = !{i32 1, !"wchar_size", i32 4}
169 ; CHECK: !1 = !{!"clang"}
171 ; CHECK: !3 = distinct !{!3, !4, !"test_loop_rotate_XX: pA:pre.rot"}
172 ; CHECK: !4 = distinct !{!4, !"test_loop_rotate_XX"}
174 ; CHECK: !6 = distinct !{!6, !4, !"test_loop_rotate_XX: pA"}
176 ; CHECK: !8 = distinct !{!8, !4, !"test_loop_rotate_XX: pA:h.rot"}
178 ; CHECK: !10 = distinct !{!10, !4, !"test_loop_rotate_XX: pA:pre.rot"}
179 ; CHECK: !11 = !{!12}
180 ; CHECK: !12 = distinct !{!12, !4, !"test_loop_rotate_XX: pA:h.rot"}
181 ; CHECK: !13 = !{!14}
182 ; CHECK: !14 = distinct !{!14, !4, !"test_loop_rotate_XX: pA:pre.rot"}
183 ; CHECK: !15 = !{!16}
184 ; CHECK: !16 = distinct !{!16, !4, !"test_loop_rotate_XX: pA:h.rot"}