1; RUN: opt < %s -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 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 nocapture readonly %d) { 38entry: 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 48 br label %for.body 49 50; CHECK-LABEL: @test2 51; CHECK: vector.body: 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 55; CHECK: for.body: 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 59; CHECK: ret void 60 61for.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 73 74for.end: ; preds = %for.body 75 ret void 76} 77 78define void @predicated_noalias_scope_decl(ptr noalias nocapture readonly %a, ptr noalias nocapture %b, i32 %n) { 79 80; Check that the vector.body still contains a llvm.experimental.noalias.scope.decl 81 82; CHECK-LABEL: @predicated_noalias_scope_decl( 83; CHECK: vector.body: 84; CHECK: call void @llvm.experimental.noalias.scope.decl 85; CHECK-NOT: @llvm.experimental.noalias.scope.decl 86; CHECK: scalar.ph: 87; CHECK-NOT: @llvm.experimental.noalias.scope.decl 88; CHECK: if.else: 89; CHECK: call void @llvm.experimental.noalias.scope.decl 90; CHECK-NOT: @llvm.experimental.noalias.scope.decl 91; CHECK: } 92 93entry: 94 %cmp15 = icmp eq i32 %n, 0 95 br i1 %cmp15, label %for.cond.cleanup, label %for.body.preheader 96 97for.body.preheader: ; preds = %entry 98 %0 = zext i32 %n to i64 99 br label %for.body 100 101for.cond.cleanup.loopexit: ; preds = %if.end5 102 br label %for.cond.cleanup 103 104for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry 105 ret void 106 107for.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 111 112if.else: ; preds = %for.body 113 %cmp2 = icmp ult i64 %indvars.iv, 991232 114 tail call void @llvm.experimental.noalias.scope.decl(metadata !0) 115 br label %if.end5 116 117if.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 127} 128 129!0 = !{ !1 } 130!1 = distinct !{ !1, !2 } 131!2 = distinct !{ !2 } 132!3 = distinct !{ !3, !2 } 133!4 = !{ !3 } 134 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]]} 140