================
@@ -1247,10 +1247,16 @@ class InlineCostCallAnalyzer final : public 
CallAnalyzer {
 };
 
 // Return true if CB is the sole call to local function Callee.
+//
+// A linkonce_odr function marked "frontend-hint-likely-module-local" counts as
+// local too: no other module is expected to reference it, so we expect
+// inlining the sole call to turn the original dead.
 static bool isSoleCallToLocalFunction(const CallBase &CB,
                                       const Function &Callee) {
-  return Callee.hasLocalLinkage() && Callee.hasOneLiveUse() &&
-         &Callee == CB.getCalledFunction();
+  bool Local = Callee.hasLocalLinkage() ||
+               (Callee.hasLinkOnceODRLinkage() &&
+                Callee.hasFnAttribute("frontend-hint-likely-module-local"));
----------------
nikic wrote:

Needs LangRef specification. I also think the `frontend-hint` part should be 
dropped, the source of the hint is not really relevant?

https://github.com/llvm/llvm-project/pull/228074
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to