if (Ref->getType() != AliasType)
Aliasee = llvm::ConstantExpr::getBitCast(Ref, AliasType);
+ // Instead of creating as alias to a linkonce_odr, replace all of the uses
+ // of the aliassee.
+ if (Linkage == llvm::GlobalValue::LinkOnceODRLinkage) {
+ Replacements[MangledName] = Aliasee;
+ return false;
+ }
+
// Don't create an alias to a linker weak symbol unless we know we can do
// that in every TU. This avoids producing different COMDATs in different
// TUs.
if (!InEveryTU)
return true;
- // Instead of creating as alias to a linkonce_odr, replace all of the uses
- // of the aliassee.
- if (Linkage == llvm::GlobalValue::LinkOnceODRLinkage) {
- Replacements[MangledName] = Aliasee;
- return false;
- }
assert(Linkage == TargetLinkage);
}
namespace test4 {
// Test that we don't produce aliases from B to A. We cannot because we cannot
- // guarantee that they will be present in every TU.
+ // guarantee that they will be present in every TU. Instead, we just call
+ // A's destructor directly.
- // CHECK-DAG: define linkonce_odr void @_ZN5test41BD2Ev(
// CHECK-DAG: define linkonce_odr void @_ZN5test41AD2Ev(
+ // CHECK-DAG: call i32 @__cxa_atexit{{.*}}_ZN5test41AD2Ev
struct A {
virtual ~A() {}
};
allocator::~allocator() throw() { foo(); }
// CHECK-LABEL: define void @_ZN6PR75263fooEv()
- // CHECK: call void @_ZN6PR752617allocator_derivedD2Ev
+ // CHECK: call void {{.*}} @_ZN6PR75269allocatorD2Ev
void foo() {
allocator_derived ad;