From b5dffd4957dfb58c73e168a3d9b6967f03b23a6c Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Tue, 10 Oct 2023 09:47:13 +0800 Subject: =?UTF-8?q?[C++20]=20[Modules]=20Don't=20emit=20function=20bodies?= =?UTF-8?q?=20which=20is=20noinline=20and=20av=E2=80=A6=20(#68501)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …ailabl externally A workaround for https://github.com/llvm/llvm-project/issues/60996 As the title suggested, we can avoid emitting available externally functions which is marked as noinline already. Such functions should contribute nothing for optimizations. The update for docs will be sent seperately if this got approved. --- clang/lib/CodeGen/CodeGenModule.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index d6ab7b3567b9..754377bed7f7 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3849,6 +3849,9 @@ bool CodeGenModule::shouldEmitFunction(GlobalDecl GD) { if (CodeGenOpts.OptimizationLevel == 0 && !F->hasAttr()) return false; + if (F->hasAttr()) + return false; + if (F->hasAttr() && !F->hasAttr()) { // Check whether it would be safe to inline this dllimport function. DLLImportFunctionVisitor Visitor; -- cgit v1.2.3