summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2023-10-10 09:47:13 +0800
committerGitHub <noreply@github.com>2023-10-10 09:47:13 +0800
commitb5dffd4957dfb58c73e168a3d9b6967f03b23a6c (patch)
treefdbd0e1156adb8dc6290fd9bdc25d74a5b6d6345 /clang/lib/CodeGen/CodeGenModule.cpp
parent057ec767add8d4030beb5b78b706dcf134269c2b (diff)
[C++20] [Modules] Don't emit function bodies which is noinline and av… (#68501)
…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.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp3
1 files changed, 3 insertions, 0 deletions
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<AlwaysInlineAttr>())
return false;
+ if (F->hasAttr<NoInlineAttr>())
+ return false;
+
if (F->hasAttr<DLLImportAttr>() && !F->hasAttr<AlwaysInlineAttr>()) {
// Check whether it would be safe to inline this dllimport function.
DLLImportFunctionVisitor Visitor;