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

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 7 22:42:30 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;
----------------
chenzheng1030 wrote:

+1
And except for the functionality issue, do we need to exclude the PPC features that should not impact the inline optimization, like fusion related features `fuse-store`, `fuse-zeromove` and other optimization related features like `fast-MFLR`, `modern-aix-as`, `ppc-postra-sched`... Inline optimization may introduce bigger improvement than breaking these optimization related features?

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


More information about the llvm-commits mailing list