[llvm] [VectorCombine] Scalarize bin ops and cmps with two splatted operands (PR #137786)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 29 11:28:04 PDT 2025
================
@@ -1099,29 +1110,33 @@ bool VectorCombine::scalarizeBinopOrCmp(Instruction &I) {
// Get cost estimate for the insert element. This cost will factor into
// both sequences.
InstructionCost InsertCost = TTI.getVectorInstrCost(
- Instruction::InsertElement, VecTy, CostKind, Index);
- InstructionCost OldCost =
- (IsConst0 ? 0 : InsertCost) + (IsConst1 ? 0 : InsertCost) + VectorOpCost;
- InstructionCost NewCost = ScalarOpCost + InsertCost +
- (IsConst0 ? 0 : !Ins0->hasOneUse() * InsertCost) +
- (IsConst1 ? 0 : !Ins1->hasOneUse() * InsertCost);
+ Instruction::InsertElement, VecTy, CostKind, Index.value_or(0));
+ InstructionCost OldCost = (isa<Constant>(Ins0) ? 0 : InsertCost) +
+ (isa<Constant>(Ins1) ? 0 : InsertCost) +
+ VectorOpCost;
+ InstructionCost NewCost =
----------------
preames wrote:
Same basic costing problem with the NewCost too.
https://github.com/llvm/llvm-project/pull/137786
More information about the llvm-commits
mailing list