1 ; RUN: opt < %s -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
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 nocapture readonly %d) {
39 %b = getelementptr inbounds %struct.data, ptr %d, i64 0, i32 1
40 %0 = load ptr, ptr %b, align 8
41 %ptrint = ptrtoint ptr %0 to i64
42 %maskedptr = and i64 %ptrint, 31
43 %maskcond = icmp eq i64 %maskedptr, 0
44 %1 = load ptr, ptr %d, align 8
45 %ptrint2 = ptrtoint ptr %1 to i64
46 %maskedptr3 = and i64 %ptrint2, 31
47 %maskcond4 = icmp eq i64 %maskedptr3, 0
52 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE0_LIST:!.*]])
53 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE4_LIST:!.*]])
54 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
56 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE0_LIST]])
57 ; CHECK: @llvm.experimental.noalias.scope.decl(metadata [[SCOPE4_LIST]])
58 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
61 for.body: ; preds = %for.body, %entry
62 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
63 tail call void @llvm.experimental.noalias.scope.decl(metadata !0)
64 %arrayidx = getelementptr inbounds float, ptr %0, i64 %indvars.iv
65 %2 = load float, ptr %arrayidx, align 4
66 %add = fadd float %2, 1.000000e+00
67 tail call void @llvm.experimental.noalias.scope.decl(metadata !4)
68 %arrayidx5 = getelementptr inbounds float, ptr %1, i64 %indvars.iv
69 store float %add, ptr %arrayidx5, align 4
70 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
71 %exitcond = icmp eq i64 %indvars.iv, 1599
72 br i1 %exitcond, label %for.end, label %for.body
74 for.end: ; preds = %for.body
78 define void @predicated_noalias_scope_decl(ptr noalias nocapture readonly %a, ptr noalias nocapture %b, i32 %n) {
80 ; Check that the vector.body still contains a llvm.experimental.noalias.scope.decl
82 ; CHECK-LABEL: @predicated_noalias_scope_decl(
84 ; CHECK: call void @llvm.experimental.noalias.scope.decl
85 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
87 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
89 ; CHECK: call void @llvm.experimental.noalias.scope.decl
90 ; CHECK-NOT: @llvm.experimental.noalias.scope.decl
94 %cmp15 = icmp eq i32 %n, 0
95 br i1 %cmp15, label %for.cond.cleanup, label %for.body.preheader
97 for.body.preheader: ; preds = %entry
98 %0 = zext i32 %n to i64
101 for.cond.cleanup.loopexit: ; preds = %if.end5
102 br label %for.cond.cleanup
104 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
107 for.body: ; preds = %for.body.preheader, %if.end5
108 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %if.end5 ]
109 %cmp1 = icmp ult i64 %indvars.iv, 495616
110 br i1 %cmp1, label %if.end5, label %if.else
112 if.else: ; preds = %for.body
113 %cmp2 = icmp ult i64 %indvars.iv, 991232
114 tail call void @llvm.experimental.noalias.scope.decl(metadata !0)
117 if.end5: ; preds = %for.body, %if.else
118 %x.0 = phi float [ 4.200000e+01, %if.else ], [ 2.300000e+01, %for.body ]
119 %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv
120 %1 = load float, ptr %arrayidx, align 4
121 %mul = fmul float %x.0, %1
122 %arrayidx7 = getelementptr inbounds float, ptr %b, i64 %indvars.iv
123 store float %mul, ptr %arrayidx7, align 4
124 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
125 %cmp = icmp eq i64 %indvars.iv.next, %0
126 br i1 %cmp, label %for.cond.cleanup.loopexit, label %for.body
130 !1 = distinct !{ !1, !2 }
131 !2 = distinct !{ !2 }
132 !3 = distinct !{ !3, !2 }
135 ; CHECK: [[SCOPE0_LIST]] = !{[[SCOPE0:!.*]]}
136 ; CHECK: [[SCOPE0]] = distinct !{[[SCOPE0]], [[SCOPE0_DOM:!.*]]}
137 ; CHECK: [[SCOPE0_DOM]] = distinct !{[[SCOPE0_DOM]]}
138 ; CHECK: [[SCOPE4_LIST]] = !{[[SCOPE4:!.*]]}
139 ; CHECK: [[SCOPE4]] = distinct !{[[SCOPE4]], [[SCOPE0_DOM]]}