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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 21:44:17 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) +
----------------
arsenm wrote:

```suggestion
      return getScalarizationOverhead(SrcVTy, /*Insert=*/ false,
                                      /*Extract=*/ true, CostKind) +
             getScalarizationOverhead(DstVTy, /*Insert=*/ true,
                                      /*Extract=*/ false, CostKind) +
```

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


More information about the llvm-commits mailing list