llvm-project
15141233 - [CIR] Skip trivially-recursive available_externally function bodies (#198363)

Commit
91 days ago
[CIR] Skip trivially-recursive available_externally function bodies (#198363) CIR was emitting available_externally bodies for glibc-style inline wrappers whose sole call is back to the same asm-named symbol (via __builtin_*). LLVM then treats the function as non-terminating and can fold away surrounding null checks — the same failure mode as classic CodeGen PR9614 (basename-style if (cwd) paths). Port isTriviallyRecursive / shouldEmitFunction from CodeGenModule, including the isInlineBuiltinDeclaration exemption, and skip emitting those definitions. isTriviallyRecursive (and its FunctionIsDirectlyRecursive visitor) lives on MangleContext, so both classic CodeGen and CIRGen call getMangleContext().isTriviallyRecursive(FD).
Author
Parents
Loading