[llvm] [TTI] Include scalarization overhead for icmp/fcmp result (PR #206697)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 13 03:53:30 PDT 2026
================
@@ -1464,9 +1464,14 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
// Return the cost of multiple scalar invocation plus the cost of
// inserting and extracting the values.
- return getScalarizationOverhead(ValVTy, /*Insert*/ true,
- /*Extract*/ false, CostKind) +
- Num * Cost;
+ InstructionCost Overhead =
+ getScalarizationOverhead(ValVTy, /*Insert*/ false,
+ /*Extract*/ true, CostKind);
+ if (Opcode == Instruction::ICmp || Opcode == Instruction::FCmp)
+ Overhead +=
+ getScalarizationOverhead(cast<VectorType>(CondTy), /*Insert*/ true,
+ /*Extract*/ false, CostKind);
+ return Overhead + Num * Cost;
----------------
lukel97 wrote:
Yeah it should be an extract per operand for icmp + fcmp, but I figured that was a separate issue from the condition type. Happy to do that in this PR though.
Just realising I've also switched insert -> extract for selects, whoops.
https://github.com/llvm/llvm-project/pull/206697
More information about the llvm-commits
mailing list