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 2 3define void @test1(ptr noalias nocapture %a, ptr noalias nocapture readonly %b) { 4entry: 5 br label %for.body 6 7; CHECK-LABEL: @test1 8; CHECK: vector.body: 9; CHECK: @llvm.experimental.noalias.scope.decl 10; CHECK-NOT: @llvm.experimental.noalias.scope.decl 11; CHECK: for.body: 12; CHECK: @llvm.experimental.noalias.scope.decl 13; CHECK-NOT: @llvm.experimental.noalias.scope.decl 14; CHECK: ret void 15 16for.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 28 29for.end: ; preds = %for.body 30 ret void 31} 32 33declare void @llvm.experimental.noalias.scope.decl(metadata) 34 35%struct.data = type { ptr, ptr } 36 37define void @test2(ptr %a, ptr %b) { 38; CHECK-LABEL: @test2 39; CHECK: vector.body: 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 43; CHECK: for.body: 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 47; CHECK: ret void 48entry: 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 53 br label %for.body 54 55for.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 67 68for.end: ; preds = %for.body 69 ret void 70} 71 72define void @predicated_noalias_scope_decl(ptr noalias nocapture readonly %a, ptr noalias nocapture %b, i64 %n) { 73 74; Check that the vector.body still contains a llvm.experimental.noalias.scope.decl 75 76; CHECK-LABEL: @predicated_noalias_scope_decl( 77; CHECK: vector.body: 78; CHECK: call void @llvm.experimental.noalias.scope.decl 79; CHECK-NOT: @llvm.experimental.noalias.scope.decl 80; CHECK: scalar.ph: 81; CHECK-NOT: @llvm.experimental.noalias.scope.decl 82; CHECK: if.else: 83; CHECK: call void @llvm.experimental.noalias.scope.decl 84; CHECK-NOT: @llvm.experimental.noalias.scope.decl 85; CHECK: } 86 87entry: 88 br label %for.body 89 90for.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 94 95if.else: ; preds = %for.body 96 %cmp2 = icmp ult i64 %indvars.iv, 991232 97 tail call void @llvm.experimental.noalias.scope.decl(metadata !0) 98 br label %if.end5 99 100if.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 110 111for.cond.cleanup: ; preds = %if.end5 112 ret void 113} 114 115!0 = !{ !1 } 116!1 = distinct !{ !1, !2 } 117!2 = distinct !{ !2 } 118!3 = distinct !{ !3, !2 } 119!4 = !{ !3 } 120!5 = distinct !{!5, !6} 121!6 = !{!"llvm.loop.vectorize.scalable.enable", i1 true} 122 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]]} 128