[llvm] [VPlan] Extract reverse operation for reverse accesses (PR #146525)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 27 08:08:04 PDT 2025
================
@@ -2224,21 +2238,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->hasMoreThanOneUniqueUser() || R->getNumUsers() == 0)
+ return nullptr;
+ return dyn_cast<VPRecipeBase>(*R->user_begin());
+ };
----------------
artagnon wrote:
Would be good to introduce getUniqueUndroppableUser() or hasOneUse() similar to the ones in IR? I think one of @lukel97's patches could also use it.
https://github.com/llvm/llvm-project/pull/146525
More information about the llvm-commits
mailing list