1; RUN: opt < %s -loop-vectorize -force-vector-width=4 -force-vector-interleave=2 -S | FileCheck %s 2 3define void @test1(float* noalias nocapture %a, float* 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, 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 28 29for.end: ; preds = %for.body 30 ret void 31} 32 33declare void @llvm.experimental.noalias.scope.decl(metadata) 34 35%struct.data = type { float*, float* } 36 37define void @test2(%struct.data* nocapture readonly %d) { 38entry: 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 49 br label %for.body 50 51; CHECK-LABEL: @test2 52; CHECK: vector.body: 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 56; CHECK: for.body: 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 60; CHECK: ret void 61 62for.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 74 75for.end: ; preds = %for.body 76 ret void 77} 78 79define void @predicated_noalias_scope_decl(float* noalias nocapture readonly %a, float* noalias nocapture %b, i32 %n) { 80 81; Check that the vector.body still contains a llvm.experimental.noalias.scope.decl 82 83; CHECK-LABEL: @predicated_noalias_scope_decl( 84; CHECK: vector.body: 85; CHECK: call void @llvm.experimental.noalias.scope.decl 86; CHECK-NOT: @llvm.experimental.noalias.scope.decl 87; CHECK: scalar.ph: 88; CHECK-NOT: @llvm.experimental.noalias.scope.decl 89; CHECK: if.else: 90; CHECK: call void @llvm.experimental.noalias.scope.decl 91; CHECK-NOT: @llvm.experimental.noalias.scope.decl 92; CHECK: } 93 94entry: 95 %cmp15 = icmp eq i32 %n, 0 96 br i1 %cmp15, label %for.cond.cleanup, label %for.body.preheader 97 98for.body.preheader: ; preds = %entry 99 %0 = zext i32 %n to i64 100 br label %for.body 101 102for.cond.cleanup.loopexit: ; preds = %if.end5 103 br label %for.cond.cleanup 104 105for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry 106 ret void 107 108for.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 112 113if.else: ; preds = %for.body 114 %cmp2 = icmp ult i64 %indvars.iv, 991232 115 tail call void @llvm.experimental.noalias.scope.decl(metadata !0) 116 br label %if.end5 117 118if.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 128} 129 130!0 = !{ !1 } 131!1 = distinct !{ !1, !2 } 132!2 = distinct !{ !2 } 133!3 = distinct !{ !3, !2 } 134!4 = !{ !3 } 135 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]]} 141