[llvm] [VPlan] Unroll VPReplicateRecipe by VF. (PR #142433)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 22 04:26:46 PDT 2025
================
@@ -495,9 +495,9 @@ Value *VPInstruction::generate(VPTransformState &State) {
}
case Instruction::ExtractElement: {
assert(State.VF.isVector() && "Only extract elements from vectors");
- Value *Vec = State.get(getOperand(0));
- Value *Idx = State.get(getOperand(1), /*IsScalar=*/true);
- return Builder.CreateExtractElement(Vec, Idx, Name);
+ unsigned IdxToExtract =
+ cast<ConstantInt>(getOperand(1)->getLiveInIRValue())->getZExtValue();
+ return State.get(getOperand(0), VPLane(IdxToExtract));
----------------
ayalz wrote:
The fact that the second operand must be constant should be documented and verified (if modeled as a general operand rather than a "flag").
https://github.com/llvm/llvm-project/pull/142433
More information about the llvm-commits
mailing list