[clang] [CIR] Skip trivially-recursive available_externally function bodies (PR #198363)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 23 06:22:07 PDT 2026


================
@@ -2648,6 +2649,12 @@ class FunctionDecl : public DeclaratorDecl,
   /// Determine if this function provides an inline implementation of a builtin.
   bool isInlineBuiltinDeclaration() const;
 
+  /// Return true if this function's body contains only a direct call back to
+  /// the same symbol via an asm label or a __builtin_* alias.  Such
+  /// available_externally bodies are not valid stand-ins for the real
+  /// implementation (PR9614) and should be dropped before codegen.
+  bool isTriviallyRecursive(MangleContext &MC) const;
----------------
erichkeane wrote:

We probably shouldn't be doing mangle-contexts inside of our declarations here, thats a bit of a layering violation.  Perhaps this is a valuable function to put in the `MangleContext` itself?

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


More information about the cfe-commits mailing list