1 ; RUN: opt < %s -scalable-vectorization=on -force-target-supports-scalable-vectors=true -passes=loop-vectorize -force-vector-width=4 -force-vector-interleave=2 -S | FileCheck %s
3 define void @test1(ptr noalias nocapture %a, ptr noalias nocapture readonly %b) {
9 ; CHECK: @llvm.experimental.noalias.scope.decl
10 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
12 ; CHECK: @llvm.experimental.noalias.scope.decl
13 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
16 for.body: ; preds = %for.body, %entry
17 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
18 %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv
19 %0 = load float, ptr %arrayidx, align 4
20 %cmp1 = fcmp ogt float %0, 1.000000e+02
21 tail call void @llvm.experimental.noalias.scope.decl(metadata !0)
22 %add = fadd float %0, 1.000000e+00
23 %arrayidx5 = getelementptr inbounds float, ptr %a, i64 %indvars.iv
24 store float %add, ptr %arrayidx5, align 4
25 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
26 %exitcond = icmp eq i64 %indvars.iv, 1599
27 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !5
29 for.end: ; preds = %for.body
33 declare void @llvm.experimental.noalias.scope.decl(metadata)
35 %struct.data = type { ptr, ptr }
37 define void @test2(ptr %a, ptr %b) {
40 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE0_LIST:!.*]])
41 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE4_LIST:!.*]])
42 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
44 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE0_LIST]])
45 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE4_LIST]])
46 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
49 %ptrint = ptrtoint ptr %b to i64
50 %maskcond = icmp eq i64 %ptrint, 0
51 %ptrint2 = ptrtoint ptr %a to i64
52 %maskcond4 = icmp eq i64 %ptrint2, 0
55 for.body: ; preds = %for.body, %entry
56 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
57 tail call void @llvm.experimental.noalias.scope.decl(metadata !0)
58 %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv
59 %0 = load float, ptr %arrayidx, align 4
60 %add = fadd float %0, 1.000000e+00
61 tail call void @llvm.experimental.noalias.scope.decl(metadata !4)
62 %arrayidx5 = getelementptr inbounds float, ptr %a, i64 %indvars.iv
63 store float %add, ptr %arrayidx5, align 4
64 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
65 %exitcond = icmp eq i64 %indvars.iv, 1599
66 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !5
68 for.end: ; preds = %for.body
72 define void @predicated_noalias_scope_decl(ptr noalias nocapture readonly %a, ptr noalias nocapture %b, i64 %n) {
74 ; Check that the vector.body still contains a llvm.experimental.noalias.scope.decl
76 ; CHECK-LABEL: @predicated_noalias_scope_decl(
78 ; CHECK: call void @llvm.experimental.noalias.scope.decl
79 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
81 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
83 ; CHECK: call void @llvm.experimental.noalias.scope.decl
84 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
90 for.body: ; preds = %entry, %if.end5
91 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %if.end5 ]
92 %cmp1 = icmp ult i64 %indvars.iv, 495616
93 br i1 %cmp1, label %if.end5, label %if.else
95 if.else: ; preds = %for.body
96 %cmp2 = icmp ult i64 %indvars.iv, 991232
97 tail call void @llvm.experimental.noalias.scope.decl(metadata !0)
100 if.end5: ; preds = %for.body, %if.else
101 %x.0 = phi float [ 4.200000e+01, %if.else ], [ 2.300000e+01, %for.body ]
102 %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv
103 %0 = load float, ptr %arrayidx, align 4
104 %mul = fmul float %x.0, %0
105 %arrayidx7 = getelementptr inbounds float, ptr %b, i64 %indvars.iv
106 store float %mul, ptr %arrayidx7, align 4
107 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
108 %cmp = icmp eq i64 %indvars.iv.next, %n
109 br i1 %cmp, label %for.cond.cleanup, label %for.body, !llvm.loop !5
111 for.cond.cleanup: ; preds = %if.end5
116 !1 = distinct !{ !1, !2 }
117 !2 = distinct !{ !2 }
118 !3 = distinct !{ !3, !2 }
120 !5 = distinct !{!5, !6}
121 !6 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}
123 ; CHECK: [[SCOPE0_LIST]] = !{[[SCOPE0:!.*]]}
124 ; CHECK: [[SCOPE0]] = distinct !{[[SCOPE0]], [[SCOPE0_DOM:!.*]]}
125 ; CHECK: [[SCOPE0_DOM]] = distinct !{[[SCOPE0_DOM]]}
126 ; CHECK: [[SCOPE4_LIST]] = !{[[SCOPE4:!.*]]}
127 ; CHECK: [[SCOPE4]] = distinct !{[[SCOPE4]], [[SCOPE0_DOM]]}