getCastInstrCost()

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 07:47:37 PST 2017


Hi,

For a vector that needs to be split, a value of 1 shouldn't be returned 
for a legal/promoted cast.

SrcLT.first could be returned here, but this seems to be a scalar 
heuristic to just return 1.

Letting this be just a scalar check, seems to return the desired result 
in the later in the handling of vector types.

/ Jonas

PS. the handling for vector types should probably be reorganized a bit. 
In this case, this check could just be moved down instead into the 
scalar checks.


     // If the cast is marked as legal (or promote) then assume low cost.
-    if (SrcLT.first == DstLT.first &&
+    if ((!Src->isVectorTy() && !Dst->isVectorTy()) &&
+        SrcLT.first == DstLT.first &&
          TLI->isOperationLegalOrPromote(ISD, DstLT.second))
        return 1;




More information about the llvm-commits mailing list