[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
This commit is contained in:
David Majnemer
2015-09-12 06:37:42 +00:00
parent dcba38a78b
commit 67cb9740f6
2 changed files with 17 additions and 13 deletions

View File

@@ -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();