[llvm] [BasicTTI] When costing a scalarized cast, use distinct src and dest types (PR #109325)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 10:47:23 PDT 2024


================
@@ -1186,8 +1186,10 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
 
       // Return the cost of multiple scalar invocation plus the cost of
       // inserting and extracting the values.
-      return getScalarizationOverhead(DstVTy, /*Insert*/ true, /*Extract*/ true,
-                                      CostKind) +
+      return getScalarizationOverhead(SrcVTy, /*Insert*/ false,
+                                      /*Extract*/ true, CostKind) +
+             getScalarizationOverhead(DstVTy, /*Insert*/ true,
+                                      /*Extract*/ false, CostKind) +
----------------
preames wrote:

This is specifically costing the case where we are scalarizing.  We're generating O(#lanes) scalar casts, and this part is just the insert/extract.  

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


More information about the llvm-commits mailing list