[llvm] 1fa5603 - [CostModel][X86] getIntrinsicInstrCost - lrint/llrint costs can use getCastInstrCost without argument data

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 01:12:21 PST 2025


Author: Simon Pilgrim
Date: 2025-01-24T09:12:07Z
New Revision: 1fa56038f6ea2b35e7b51d8151cfe7dfcb3abcf3

URL: https://github.com/llvm/llvm-project/commit/1fa56038f6ea2b35e7b51d8151cfe7dfcb3abcf3
DIFF: https://github.com/llvm/llvm-project/commit/1fa56038f6ea2b35e7b51d8151cfe7dfcb3abcf3.diff

LOG: [CostModel][X86] getIntrinsicInstrCost - lrint/llrint costs can use getCastInstrCost without argument data

We don't use the IntrinsicCostAttributes arguments so, which allows us to use in type-only analysis in a future patch.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86TargetTransformInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index 413b54343ef0e3..34ba46f5e6cfd5 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -4482,15 +4482,13 @@ X86TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
     }
     break;
   case Intrinsic::lrint:
-  case Intrinsic::llrint:
+  case Intrinsic::llrint: {
     // X86 can use the CVTP2SI instructions to lower lrint/llrint calls, which
     // have the same costs as the CVTTP2SI (fptosi) instructions
-    if (!ICA.isTypeBasedOnly()) {
-      const SmallVectorImpl<Type *> &ArgTys = ICA.getArgTypes();
-      return getCastInstrCost(Instruction::FPToSI, RetTy, ArgTys[0],
-                              TTI::CastContextHint::None, CostKind);
-    }
-    break;
+    const SmallVectorImpl<Type *> &ArgTys = ICA.getArgTypes();
+    return getCastInstrCost(Instruction::FPToSI, RetTy, ArgTys[0],
+                            TTI::CastContextHint::None, CostKind);
+  }
   case Intrinsic::maxnum:
   case Intrinsic::minnum:
     // FMINNUM has same costs so don't duplicate.


        


More information about the llvm-commits mailing list