[llvm] [VPlan] Unroll VPReplicateRecipe by VF. (PR #142433)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 25 12:02:38 PDT 2025
================
@@ -608,6 +608,32 @@ Value *VPInstruction::generate(VPTransformState &State) {
return Builder.CreateVectorSplat(
State.VF, State.get(getOperand(0), /*IsScalar*/ true), "broadcast");
}
+ case VPInstruction::BuildStructVector: {
+ // For struct types, we need to build a new 'wide' struct type, where each
+ // element is widened, i.e. we crate a struct of vectors .
+ auto *StructTy =
+ cast<StructType>(State.TypeAnalysis.inferScalarType(getOperand(0)));
+ Value *Res = PoisonValue::get(toVectorizedTy(StructTy, State.VF));
+ for (const auto &[Idx, Op] : enumerate(operands())) {
+ for (unsigned I = 0; I != StructTy->getNumElements(); I++) {
----------------
fhahn wrote:
Currently this matches the construction order as `packScalarIntoVectorizedValue`, would probably be good to only adjust once its last user has been removed.
Currently that's stil lin State.set, but will double-check if that code is actually used for struct types (only should be relevant for recipes in replicate regions)
https://github.com/llvm/llvm-project/pull/142433
More information about the llvm-commits
mailing list