[llvm] [VPlan] Introduce VPlanConstantFolder (PR #125365)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Tue May 6 06:55:22 PDT 2025
================
@@ -2728,8 +2728,15 @@ InstructionCost VPBranchOnMaskRecipe::computeCost(ElementCount VF,
void VPPredInstPHIRecipe::execute(VPTransformState &State) {
assert(State.Lane && "Predicated instruction PHI works per instance.");
- Instruction *ScalarPredInst =
- cast<Instruction>(State.get(getOperand(0), *State.Lane));
+ Value *ScalarPred = State.get(getOperand(0), *State.Lane);
+ Instruction *ScalarPredInst = dyn_cast<Instruction>(ScalarPred);
+ if (!ScalarPredInst) {
+ if (State.hasScalarValue(this, *State.Lane))
+ State.reset(this, ScalarPred, *State.Lane);
+ else
+ State.set(this, ScalarPred, *State.Lane);
+ return;
+ }
----------------
artagnon wrote:
Unfortunately, it is impossible to cook up a test that will facilitate sending this change independently: the short-sighted handling is only exposed by the constant-folding patch.
https://github.com/llvm/llvm-project/pull/125365
More information about the llvm-commits
mailing list