[cfe-commits] r123275 - in /cfe/trunk: lib/CodeGen/CGRTTI.cpp lib/CodeGen/CodeGenModule.cpp test/CodeGenCXX/rtti-linkage.cpp test/CodeGenCXX/vtable-linkage.cpp
Rafael Espindola
rafael.espindola at gmail.com
Tue Jan 11 13:44:37 PST 2011
Author: rafael
Date: Tue Jan 11 15:44:37 2011
New Revision: 123275
URL: http://llvm.org/viewvc/llvm-project?rev=123275&view=rev
Log:
Set unnamed_addr for type infos that we are confortable marking as hidden. I
think it is safe to mark all type infos with unnamed_addr, but I am not sure.
Modified:
cfe/trunk/lib/CodeGen/CGRTTI.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp
cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp
Modified: cfe/trunk/lib/CodeGen/CGRTTI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRTTI.cpp?rev=123275&r1=123274&r2=123275&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRTTI.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRTTI.cpp Tue Jan 11 15:44:37 2011
@@ -640,8 +640,12 @@
/*ForRTTI*/ true, /*ForDefinition*/ true);
else if (Hidden ||
(CGM.getCodeGenOpts().HiddenWeakVTables &&
- Linkage == llvm::GlobalValue::WeakODRLinkage))
+ Linkage == llvm::GlobalValue::WeakODRLinkage)) {
GV->setVisibility(llvm::GlobalValue::HiddenVisibility);
+
+ // FIXME: Should we set this for all type infos?
+ GV->setUnnamedAddr(true);
+ }
return llvm::ConstantExpr::getBitCast(GV, Int8PtrTy);
}
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=123275&r1=123274&r2=123275&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Jan 11 15:44:37 2011
@@ -251,6 +251,7 @@
// Otherwise, drop the visibility to hidden.
GV->setVisibility(llvm::GlobalValue::HiddenVisibility);
+ GV->setUnnamedAddr(true);
}
llvm::StringRef CodeGenModule::getMangledName(GlobalDecl GD) {
Modified: cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp?rev=123275&r1=123274&r2=123275&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp Tue Jan 11 15:44:37 2011
@@ -7,7 +7,7 @@
// CHECK-WITH-HIDDEN: @_ZTSPK2T4 = weak_odr hidden constant
// CHECK-WITH-HIDDEN: @_ZTS2T4 = weak_odr hidden constant
// CHECK-WITH-HIDDEN: @_ZTI2T4 = weak_odr hidden constant
-// CHECK-WITH-HIDDEN: @_ZTIPK2T4 = weak_odr hidden constant
+// CHECK-WITH-HIDDEN: @_ZTIPK2T4 = weak_odr hidden unnamed_addr constant
// CHECK: _ZTSP1C = internal constant
// CHECK: _ZTS1C = internal constant
@@ -25,7 +25,7 @@
// CHECK: _ZTIM1CPS_ = internal constant
// CHECK: _ZTSM1A1C = internal constant
// CHECK: _ZTS1A = weak_odr constant
-// CHECK: _ZTI1A = weak_odr hidden constant
+// CHECK: _ZTI1A = weak_odr hidden unnamed_addr constant
// CHECK: _ZTIM1A1C = internal constant
// CHECK: _ZTSM1AP1C = internal constant
// CHECK: _ZTIM1AP1C = internal constant
@@ -39,12 +39,12 @@
// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal constant
// CHECK: _ZTSPFvvE = weak_odr constant
// CHECK: _ZTSFvvE = weak_odr constant
-// CHECK: _ZTIFvvE = weak_odr hidden constant
-// CHECK: _ZTIPFvvE = weak_odr hidden constant
+// CHECK: _ZTIFvvE = weak_odr hidden unnamed_addr constant
+// CHECK: _ZTIPFvvE = weak_odr hidden unnamed_addr constant
// CHECK: _ZTSN12_GLOBAL__N_11EE = internal constant
// CHECK: _ZTIN12_GLOBAL__N_11EE = internal constant
// CHECK: _ZTSA10_i = weak_odr constant
-// CHECK: _ZTIA10_i = weak_odr hidden constant
+// CHECK: _ZTIA10_i = weak_odr hidden unnamed_addr constant
// CHECK: _ZTI1TILj0EE = weak_odr constant
// CHECK: _ZTI1TILj1EE = weak_odr constant
// CHECK: _ZTI1TILj2EE = external constant
Modified: cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp?rev=123275&r1=123274&r2=123275&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp Tue Jan 11 15:44:37 2011
@@ -108,7 +108,7 @@
// CHECK-2: @_ZTI1C = weak_odr constant
// CHECK-2-HIDDEN: @_ZTV1C = weak_odr hidden unnamed_addr constant
// CHECK-2-HIDDEN: @_ZTS1C = weak_odr constant
-// CHECK-2-HIDDEN: @_ZTI1C = weak_odr hidden constant
+// CHECK-2-HIDDEN: @_ZTI1C = weak_odr hidden unnamed_addr constant
// D has a key function that is defined in this translation unit so its vtable is
// defined in the translation unit.
More information about the cfe-commits
mailing list