r247500 - [CodeGen] Remove wrapper-free always_inline functions from COMDATs
David Majnemer via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 11 23:37:42 PDT 2015
Author: majnemer
Date: Sat Sep 12 01:37:42 2015
New Revision: 247500
URL: http://llvm.org/viewvc/llvm-project?rev=247500&view=rev
Log:
[CodeGen] Remove wrapper-free always_inline functions from COMDATs
always_inline functions without a wrapper don't need to be in a COMDAT.
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGenCXX/alwaysinline.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=247500&r1=247499&r2=247500&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sat Sep 12 01:37:42 2015
@@ -494,8 +494,12 @@ void CodeGenModule::RewriteAlwaysInlineF
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();
Modified: cfe/trunk/test/CodeGenCXX/alwaysinline.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/alwaysinline.cpp?rev=247500&r1=247499&r2=247500&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/alwaysinline.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/alwaysinline.cpp Sat Sep 12 01:37:42 2015
@@ -33,20 +33,20 @@ void g3() {
A3 a3;
}
-// CHECK-DAG: define internal void @_ZN2A1C1Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI:[01-9]+]]
-// CHECK-DAG: define internal void @_ZN2A1C2Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI]]
-// CHECK-DAG: define internal void @_ZN2A1D1Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI]]
-// CHECK-DAG: define internal void @_ZN2A1D2Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI]]
+// CHECK-DAG: define internal void @_ZN2A1C1Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI:[01-9]+]] align 2 {
+// CHECK-DAG: define internal void @_ZN2A1C2Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI]] align 2 {
+// CHECK-DAG: define internal void @_ZN2A1D1Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI]] align 2 {
+// CHECK-DAG: define internal void @_ZN2A1D2Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI]] align 2 {
-// CHECK-DAG: define internal void @_ZN2A2C1Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH:[01-9]+]]
-// CHECK-DAG: define internal void @_ZN2A2C2Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH]]
-// CHECK-DAG: define internal void @_ZN2A2D1Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH]]
-// CHECK-DAG: define internal void @_ZN2A2D2Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH]]
+// CHECK-DAG: define internal void @_ZN2A2C1Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH:[01-9]+]] align 2 {
+// CHECK-DAG: define internal void @_ZN2A2C2Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH]] align 2 {
+// CHECK-DAG: define internal void @_ZN2A2D1Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH]] align 2 {
+// CHECK-DAG: define internal void @_ZN2A2D2Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH]] align 2 {
-// CHECK-DAG: define internal void @_ZN2A3C1Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]]
-// CHECK-DAG: define internal void @_ZN2A3C2Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]]
-// CHECK-DAG: define internal void @_ZN2A3D1Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]]
-// CHECK-DAG: define internal void @_ZN2A3D2Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]]
+// CHECK-DAG: define internal void @_ZN2A3C1Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]] align 2 {
+// CHECK-DAG: define internal void @_ZN2A3C2Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]] align 2 {
+// CHECK-DAG: define internal void @_ZN2A3D1Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]] align 2 {
+// CHECK-DAG: define internal void @_ZN2A3D2Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]] align 2 {
// CHECK-DAG: attributes #[[AI]] = {{.*alwaysinline.*}}
// CHECK-DAG: attributes #[[AIIH]] = {{.*alwaysinline.*inlinehint.*}}
More information about the cfe-commits
mailing list