diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-09-12 06:37:42 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-09-12 06:37:42 +0000 |
commit | 67cb9740f64e88395150ed59a3294fe42d95a11f (patch) | |
tree | 84367592bc128c2f6a0ad2de96e67efc85143054 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | dcba38a78bf36aaa7911f912b81239d5d7e1d476 (diff) | |
download | llvm-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.cpp | 6 |
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(); |