[llvm] 46d3e42 - [CostModel] get type-based cost for vector intrinsics directly

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 14:27:42 PDT 2020


Author: Sanjay Patel
Date: 2020-10-12T17:27:34-04:00
New Revision: 46d3e428a83ccc0cab73abb2e39a82b1cca53a52

URL: https://github.com/llvm/llvm-project/commit/46d3e428a83ccc0cab73abb2e39a82b1cca53a52
DIFF: https://github.com/llvm/llvm-project/commit/46d3e428a83ccc0cab73abb2e39a82b1cca53a52.diff

LOG: [CostModel] get type-based cost for vector intrinsics directly

This is NFC-intended (the reductions and other intrinsics have
tests that should provide coverage) - trying to untangle the
mess that has formed here.

We were stripping the arguments off of the given
"IntrinsicCostAttributes" and then semi-recursively
calling back into getIntrinsicInstrCost() only to
then call getTypeBasedIntrinsicInstrCost(), so make
that call directly instead.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/BasicTTIImpl.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index f8a357a8479b..b833130f0348 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -1194,7 +1194,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
     case Intrinsic::vector_reduce_umax:
     case Intrinsic::vector_reduce_umin: {
       IntrinsicCostAttributes Attrs(IID, RetTy, Args[0]->getType(), FMF, 1, I);
-      return getIntrinsicInstrCost(Attrs, CostKind);
+      return getTypeBasedIntrinsicInstrCost(Attrs, CostKind);
     }
     case Intrinsic::fshl:
     case Intrinsic::fshr: {
@@ -1260,9 +1260,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
       ScalarizationCost += getOperandsScalarizationOverhead(Args, VF);
     }
 
-    IntrinsicCostAttributes Attrs(IID, RetTy, Types, FMF,
-                                  ScalarizationCost, I);
-    return thisT()->getIntrinsicInstrCost(Attrs, CostKind);
+    IntrinsicCostAttributes Attrs(IID, RetTy, Types, FMF, ScalarizationCost, I);
+    return thisT()->getTypeBasedIntrinsicInstrCost(Attrs, CostKind);
   }
 
   /// Get intrinsic cost based on argument types.


        


More information about the llvm-commits mailing list