Index: llvm/include/llvm/Support/TypeSize.h =================================================================== --- llvm/include/llvm/Support/TypeSize.h +++ llvm/include/llvm/Support/TypeSize.h @@ -48,6 +48,9 @@ assert(Min % RHS == 0 && "Min is not a multiple of RHS."); return { Min / RHS, Scalable }; } + ElementCount operator%(unsigned RHS) { + return { Min % RHS, Scalable }; + } bool operator==(const ElementCount& RHS) const { return Min == RHS.Min && Scalable == RHS.Scalable; Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp =================================================================== --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -20593,7 +20593,7 @@ SDLoc DL(N); SDValue NewIdx; LLVMContext &Ctx = *DAG.getContext(); - unsigned NumElts = VT.getVectorNumElements(); + ElementCount NumElts = VT.getVectorElementCount(); unsigned EltSizeInBits = VT.getScalarSizeInBits(); if ((EltSizeInBits % N1SrcSVT.getSizeInBits()) == 0) { unsigned Scale = EltSizeInBits / N1SrcSVT.getSizeInBits();