[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 04:22:58 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:

Updated icmp/fcmp to use getOperandsScalarizationOverhead in 4c536f9777cc9974c2e4bcf8a2f3a1fb967f50ee. Left out select for now as it pulls in more test diffs, but let me know if you want it in this PR too.

https://github.com/llvm/llvm-project/pull/206697


More information about the llvm-commits mailing list