[llvm] [PowerPC] Inline callee if its target-features are a subset of the caller (PR #67710)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 10:34:25 PDT 2023


================
@@ -885,6 +885,19 @@ PPCTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
   return BaseT::getIntrinsicInstrCost(ICA, CostKind);
 }
 
+bool PPCTTIImpl::areInlineCompatible(const Function *Caller,
+                                     const Function *Callee) const {
+  // Allow inlining only when the Callee has a subset of the Caller's features.
+  const TargetMachine &TM = getTLI()->getTargetMachine();
+
+  const FeatureBitset &CallerBits =
+      TM.getSubtargetImpl(*Caller)->getFeatureBits();
+  const FeatureBitset &CalleeBits =
+      TM.getSubtargetImpl(*Callee)->getFeatureBits();
+
+  return (CallerBits & CalleeBits) == CalleeBits;
----------------
RolandF77 wrote:

Looks like the X86 equivalent function also checks for ABI compatibility.  Wonder if that is also needed for PPC, for instance for vec-extabi.

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


More information about the llvm-commits mailing list