From 67cb9740f64e88395150ed59a3294fe42d95a11f Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sat, 12 Sep 2015 06:37:42 +0000 Subject: [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 --- clang/lib/CodeGen/CodeGenModule.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 4fe25ff3f31..660f18a694e 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(); -- cgit v1.2.3