diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -4368,7 +4368,7 @@ Base = SDB->getValue(C); - unsigned NumElts = cast(Ptr->getType())->getNumElements(); + ElementCount NumElts = cast(Ptr->getType())->getElementCount(); EVT VT = EVT::getVectorVT(*DAG.getContext(), TLI.getPointerTy(DL), NumElts); Index = DAG.getConstant(0, SDB->getCurSDLoc(), VT); IndexType = ISD::SIGNED_SCALED; diff --git a/llvm/test/CodeGen/AArch64/sve-masked-scatter.ll b/llvm/test/CodeGen/AArch64/sve-masked-scatter.ll --- a/llvm/test/CodeGen/AArch64/sve-masked-scatter.ll +++ b/llvm/test/CodeGen/AArch64/sve-masked-scatter.ll @@ -73,6 +73,24 @@ ret void } +define void @masked_scatter_splat_constant_pointer ( %pg) { +; CHECK-LABEL: masked_scatter_splat_constant_pointer: +; CHECK: // %bb.0: // %vector.body +; CHECK-NEXT: pfalse p1.b +; CHECK-NEXT: mov z0.d, #0 // =0x0 +; CHECK-NEXT: zip1 p2.s, p0.s, p1.s +; CHECK-NEXT: zip2 p0.s, p0.s, p1.s +; CHECK-NEXT: st1w { z0.d }, p2, [x8, z0.d, lsl #2] +; CHECK-NEXT: st1w { z0.d }, p0, [x8, z0.d, lsl #2] +; CHECK-NEXT: ret +vector.body: + call void @llvm.masked.scatter.nxv4i32.nxv4p0i32( undef, + shufflevector ( insertelement ( poison, i32* undef, i32 0), poison, zeroinitializer), + i32 4, + %pg) + ret void +} + declare void @llvm.masked.scatter.nxv2f16(, , i32, ) declare void @llvm.masked.scatter.nxv2bf16(, , i32, ) declare void @llvm.masked.scatter.nxv2f32(, , i32, ) @@ -81,4 +99,5 @@ declare void @llvm.masked.scatter.nxv2i32(, , i32, ) declare void @llvm.masked.scatter.nxv2i64(, , i32, ) declare void @llvm.masked.scatter.nxv2i8(, , i32, ) +declare void @llvm.masked.scatter.nxv4i32.nxv4p0i32(, , i32, ) attributes #0 = { "target-features"="+sve,+bf16" }