summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2020-04-15 11:05:22 -0700
committerTom Stellard <tstellar@redhat.com>2020-05-07 13:47:01 -0700
commit3ab301b4d9700d7ce3ebc22750166c49b45e3e98 (patch)
tree72d06204d6624fa133223e4e262afc4484af6823 /clang/lib/CodeGen
parentf082d91801645e999aa8b1072392f945405eafc5 (diff)
downloadbcm5719-llvm-3ab301b4d9700d7ce3ebc22750166c49b45e3e98.tar.gz
bcm5719-llvm-3ab301b4d9700d7ce3ebc22750166c49b45e3e98.zip
[CodeGen] only add nobuiltin to inline builtins if we'll emit them
There are some inline builtin definitions that we can't emit (isTriviallyRecursive & callers go into why). Marking these nobuiltin is only useful if we actually emit the body, so don't mark these as such unless we _do_ plan on emitting that. This suboptimality was encountered in Linux (see some discussion on D71082, and https://github.com/ClangBuiltLinux/linux/issues/979). Differential Revision: https://reviews.llvm.org/D78162 (cherry picked from commit 2dd17ff08165e6118e70f00e22b2c36d2d4e0a9a)
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index f8866ac4f7f..73c41dc4cf3 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1847,7 +1847,8 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
else if (const auto *SA = FD->getAttr<SectionAttr>())
F->setSection(SA->getName());
- if (FD->isInlineBuiltinDeclaration()) {
+ // If we plan on emitting this inline builtin, we can't treat it as a builtin.
+ if (FD->isInlineBuiltinDeclaration() && shouldEmitFunction(FD)) {
F->addAttribute(llvm::AttributeList::FunctionIndex,
llvm::Attribute::NoBuiltin);
}
OpenPOWER on IntegriCloud