1 ; RUN: opt < %s -loop-vectorize -force-vector-width=4 -force-vector-interleave=2 -S | FileCheck %s
3 define void @test1(float* noalias nocapture %a, float* 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, float* %b, i64 %indvars.iv
19 %0 = load float, float* %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, float* %a, i64 %indvars.iv
24 store float %add, float* %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
29 for.end: ; preds = %for.body
33 declare void @llvm.experimental.noalias.scope.decl(metadata)
35 %struct.data = type { float*, float* }
37 define void @test2(%struct.data* nocapture readonly %d) {
39 %b = getelementptr inbounds %struct.data, %struct.data* %d, i64 0, i32 1
40 %0 = load float*, float** %b, align 8
41 %ptrint = ptrtoint float* %0 to i64
42 %maskedptr = and i64 %ptrint, 31
43 %maskcond = icmp eq i64 %maskedptr, 0
44 %a = getelementptr inbounds %struct.data, %struct.data* %d, i64 0, i32 0
45 %1 = load float*, float** %a, align 8
46 %ptrint2 = ptrtoint float* %1 to i64
47 %maskedptr3 = and i64 %ptrint2, 31
48 %maskcond4 = icmp eq i64 %maskedptr3, 0
53 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE0_LIST:!.*]])
54 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE4_LIST:!.*]])
55 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
57 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE0_LIST]])
58 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE4_LIST]])
59 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
62 for.body: ; preds = %for.body, %entry
63 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
64 tail call void @llvm.experimental.noalias.scope.decl(metadata !0)
65 %arrayidx = getelementptr inbounds float, float* %0, i64 %indvars.iv
66 %2 = load float, float* %arrayidx, align 4
67 %add = fadd float %2, 1.000000e+00
68 tail call void @llvm.experimental.noalias.scope.decl(metadata !4)
69 %arrayidx5 = getelementptr inbounds float, float* %1, i64 %indvars.iv
70 store float %add, float* %arrayidx5, align 4
71 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
72 %exitcond = icmp eq i64 %indvars.iv, 1599
73 br i1 %exitcond, label %for.end, label %for.body
75 for.end: ; preds = %for.body
79 define void @predicated_noalias_scope_decl(float* noalias nocapture readonly %a, float* noalias nocapture %b, i32 %n) {
81 ; Check that the vector.body still contains a llvm.experimental.noalias.scope.decl
83 ; CHECK-LABEL: @predicated_noalias_scope_decl(
85 ; CHECK: call void @llvm.experimental.noalias.scope.decl
86 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
88 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
90 ; CHECK: call void @llvm.experimental.noalias.scope.decl
91 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
95 %cmp15 = icmp eq i32 %n, 0
96 br i1 %cmp15, label %for.cond.cleanup, label %for.body.preheader
98 for.body.preheader: ; preds = %entry
99 %0 = zext i32 %n to i64
102 for.cond.cleanup.loopexit: ; preds = %if.end5
103 br label %for.cond.cleanup
105 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
108 for.body: ; preds = %for.body.preheader, %if.end5
109 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %if.end5 ]
110 %cmp1 = icmp ult i64 %indvars.iv, 495616
111 br i1 %cmp1, label %if.end5, label %if.else
113 if.else: ; preds = %for.body
114 %cmp2 = icmp ult i64 %indvars.iv, 991232
115 tail call void @llvm.experimental.noalias.scope.decl(metadata !0)
118 if.end5: ; preds = %for.body, %if.else
119 %x.0 = phi float [ 4.200000e+01, %if.else ], [ 2.300000e+01, %for.body ]
120 %arrayidx = getelementptr inbounds float, float* %a, i64 %indvars.iv
121 %1 = load float, float* %arrayidx, align 4
122 %mul = fmul float %x.0, %1
123 %arrayidx7 = getelementptr inbounds float, float* %b, i64 %indvars.iv
124 store float %mul, float* %arrayidx7, align 4
125 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
126 %cmp = icmp eq i64 %indvars.iv.next, %0
127 br i1 %cmp, label %for.cond.cleanup.loopexit, label %for.body
131 !1 = distinct !{ !1, !2 }
132 !2 = distinct !{ !2 }
133 !3 = distinct !{ !3, !2 }
136 ; CHECK: [[SCOPE0_LIST]] = !{[[SCOPE0:!.*]]}
137 ; CHECK: [[SCOPE0]] = distinct !{[[SCOPE0]], [[SCOPE0_DOM:!.*]]}
138 ; CHECK: [[SCOPE0_DOM]] = distinct !{[[SCOPE0_DOM]]}
139 ; CHECK: [[SCOPE4_LIST]] = !{[[SCOPE4:!.*]]}
140 ; CHECK: [[SCOPE4]] = distinct !{[[SCOPE4]], [[SCOPE0_DOM]]}