[llvm] [LoongArch] Add areInlineCompatible (PR #117144)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 18:17:48 PST 2024


================
@@ -19,6 +19,20 @@ using namespace llvm;
 
 #define DEBUG_TYPE "loongarchtti"
 
+bool LoongArchTTIImpl::areInlineCompatible(const Function *Caller,
+                                           const Function *Callee) const {
+  const TargetMachine &TM = getTLI()->getTargetMachine();
+
+  const FeatureBitset &CallerBits =
+      TM.getSubtargetImpl(*Caller)->getFeatureBits();
+  const FeatureBitset &CalleeBits =
+      TM.getSubtargetImpl(*Callee)->getFeatureBits();
+
+  // Inline a callee if its target-features are a subset of the callers
+  // target-features.
+  return (CallerBits & CalleeBits) == CalleeBits;
+}
----------------
wangleiat wrote:

LG for LoongArch.
Agree to try making it the default implementation.

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


More information about the llvm-commits mailing list