aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-09-12 06:37:42 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-09-12 06:37:42 +0000
commit67cb9740f64e88395150ed59a3294fe42d95a11f (patch)
tree84367592bc128c2f6a0ad2de96e67efc85143054 /clang/lib/CodeGen/CodeGenModule.cpp
parentdcba38a78bf36aaa7911f912b81239d5d7e1d476 (diff)
downloadllvm-67cb9740f64e88395150ed59a3294fe42d95a11f.zip
llvm-67cb9740f64e88395150ed59a3294fe42d95a11f.tar.gz
llvm-67cb9740f64e88395150ed59a3294fe42d95a11f.tar.bz2
[CodeGen] Remove wrapper-free always_inline functions from COMDATs
always_inline functions without a wrapper don't need to be in a COMDAT. llvm-svn: 247500
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 4fe25ff..660f18a 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -494,8 +494,12 @@ void CodeGenModule::RewriteAlwaysInlineFunction(llvm::Function *Fn) {
FindNonDirectCallUses(Fn, &NonDirectCallUses);
// Do not create the wrapper if there are no non-direct call uses, and we are
// not required to emit an external definition.
- if (NonDirectCallUses.empty() && Fn->isDiscardableIfUnused())
+ if (NonDirectCallUses.empty() && Fn->isDiscardableIfUnused()) {
+ // An always inline function with no wrapper cannot legitimately use the
+ // function's COMDAT symbol.
+ Fn->setComdat(nullptr);
return;
+ }
llvm::FunctionType *FT = Fn->getFunctionType();
llvm::LLVMContext &Ctx = getModule().getContext();