[llvm] [VPlan] Extract reverse operation for reverse accesses (PR #146525)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 26 02:21:18 PST 2025
================
@@ -2341,21 +2356,37 @@ InstructionCost VPWidenCastRecipe::computeCost(ElementCount VF,
return TTI::CastContextHint::Normal;
};
+ using namespace llvm::VPlanPatternMatch;
VPValue *Operand = getOperand(0);
TTI::CastContextHint CCH = TTI::CastContextHint::None;
// For Trunc/FPTrunc, get the context from the only user.
- if ((Opcode == Instruction::Trunc || Opcode == Instruction::FPTrunc) &&
- !hasMoreThanOneUniqueUser() && getNumUsers() > 0) {
- if (auto *StoreRecipe = dyn_cast<VPRecipeBase>(*user_begin()))
- CCH = ComputeCCH(StoreRecipe);
+ if (Opcode == Instruction::Trunc || Opcode == Instruction::FPTrunc) {
+ auto GetOnlyUser = [](const VPSingleDefRecipe *R) -> VPRecipeBase * {
+ if (R->getNumUsers() == 0 || R->hasMoreThanOneUniqueUser())
+ return nullptr;
+ return dyn_cast<VPRecipeBase>(*R->user_begin());
----------------
fhahn wrote:
can this use `VPuser::getSingleUser`?
https://github.com/llvm/llvm-project/pull/146525
More information about the llvm-commits
mailing list