Add unnamed_addr to constructors and destructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123197 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CXX/except/except.spec/p14-ir.cpp b/test/CXX/except/except.spec/p14-ir.cpp
index 4d8d1f7..2b8ce65 100644
--- a/test/CXX/except/except.spec/p14-ir.cpp
+++ b/test/CXX/except/except.spec/p14-ir.cpp
@@ -26,17 +26,17 @@
 struct X5 : X0, X4 { };
 
 void test(X2 x2, X3 x3, X5 x5) {
-  // CHECK: define linkonce_odr void @_ZN2X2C1ERKS_
+  // CHECK: define linkonce_odr unnamed_addr void @_ZN2X2C1ERKS_
   // CHECK:      call void @_ZN2X2C2ERKS_({{.*}}) nounwind
   // CHECK-NEXT: ret void
   // CHECK-NEXT: }
   X2 x2a(x2);
-  // CHECK: define linkonce_odr void @_ZN2X3C1ERKS_
+  // CHECK: define linkonce_odr unnamed_addr void @_ZN2X3C1ERKS_
   // CHECK:      call void @_ZN2X3C2ERKS_({{.*}}) nounwind
   // CHECK-NEXT: ret void
   // CHECK-NEXT: }
   X3 x3a(x3);
-  // CHECK: define linkonce_odr void @_ZN2X5C1ERS_
+  // CHECK: define linkonce_odr unnamed_addr void @_ZN2X5C1ERS_
   // CHECK-NOT: call void @__cxa_call_unexpected
   // CHECK: ret void
   X5 x5a(x5);
@@ -55,24 +55,24 @@
 struct X9 : X6, X7 { };
 
 void test() {
-  // CHECK: define linkonce_odr void @_ZN2X8C1Ev
+  // CHECK: define linkonce_odr unnamed_addr void @_ZN2X8C1Ev
   // CHECK:      call void @_ZN2X8C2Ev({{.*}}) nounwind
   // CHECK-NEXT: ret void
   X8();
 
-  // CHECK: define linkonce_odr void @_ZN2X9C1Ev
+  // CHECK: define linkonce_odr unnamed_addr void @_ZN2X9C1Ev
   //   FIXME: check that this is the end of the line here:
   // CHECK:      call void @_ZN2X9C2Ev({{.*}})
   // CHECK-NEXT: ret void
   X9();
 
-  // CHECK: define linkonce_odr void @_ZN2X9C2Ev
+  // CHECK: define linkonce_odr unnamed_addr void @_ZN2X9C2Ev
   // CHECK:      call void @_ZN2X6C2Ev({{.*}}) nounwind
   //   FIXME: and here:
   // CHECK-NEXT: call void @_ZN2X7C2Ev({{.*}})
   // CHECK: ret void
 
-  // CHECK: define linkonce_odr void @_ZN2X8C2Ev
+  // CHECK: define linkonce_odr unnamed_addr void @_ZN2X8C2Ev
   // CHECK:      call void @_ZN2X6C2Ev({{.*}}) nounwind
   // CHECK-NEXT: ret void
 }
diff --git a/test/CodeGenCXX/arm.cpp b/test/CodeGenCXX/arm.cpp
index f73aa0d..365cd5a 100644
--- a/test/CodeGenCXX/arm.cpp
+++ b/test/CodeGenCXX/arm.cpp
@@ -44,7 +44,7 @@
     a.bar();
   }
 
-  // CHECK: define linkonce_odr [[A]]* @_ZN5test11AC1Ei([[A]]*
+  // CHECK: define linkonce_odr unnamed_addr [[A]]* @_ZN5test11AC1Ei([[A]]*
   // CHECK:   [[RET:%.*]] = alloca [[A]]*, align 4
   // CHECK:   [[THIS:%.*]] = alloca [[A]]*, align 4
   // CHECK:   store [[A]]* {{.*}}, [[A]]** [[THIS]]
@@ -54,7 +54,7 @@
   // CHECK:   [[THIS2:%.*]] = load [[A]]** [[RET]]
   // CHECK:   ret [[A]]* [[THIS2]]
 
-  // CHECK: define linkonce_odr [[A]]* @_ZN5test11AD1Ev([[A]]*
+  // CHECK: define linkonce_odr unnamed_addr [[A]]* @_ZN5test11AD1Ev([[A]]*
   // CHECK:   [[RET:%.*]] = alloca [[A]]*, align 4
   // CHECK:   [[THIS:%.*]] = alloca [[A]]*, align 4
   // CHECK:   store [[A]]* {{.*}}, [[A]]** [[THIS]]
diff --git a/test/CodeGenCXX/constructor-init.cpp b/test/CodeGenCXX/constructor-init.cpp
index 4e6d255..5e02a72 100644
--- a/test/CodeGenCXX/constructor-init.cpp
+++ b/test/CodeGenCXX/constructor-init.cpp
@@ -91,7 +91,7 @@
     B(int);
   };
 
-  // CHECK: define void @_ZN10InitVTable1BC2Ev(
+  // CHECK: define unnamed_addr void @_ZN10InitVTable1BC2Ev(
   // CHECK:      [[T0:%.*]] = bitcast [[B:%.*]]* [[THIS:%.*]] to i8***
   // CHECK-NEXT: store i8** getelementptr inbounds ([3 x i8*]* @_ZTVN10InitVTable1BE, i64 0, i64 2), i8*** [[T0]]
   // CHECK:      [[VTBL:%.*]] = load i32 ([[B]]*)*** {{%.*}}
@@ -104,7 +104,7 @@
   // CHECK-NEXT: ret void
   B::B() : A(foo()) {}
 
-  // CHECK: define void @_ZN10InitVTable1BC2Ei(
+  // CHECK: define unnamed_addr void @_ZN10InitVTable1BC2Ei(
   // CHECK:      [[ARG:%.*]] = add nsw i32 {{%.*}}, 5
   // CHECK-NEXT: call void @_ZN10InitVTable1AC2Ei({{.*}}* {{%.*}}, i32 [[ARG]])
   // CHECK-NEXT: [[T0:%.*]] = bitcast [[B]]* {{%.*}} to i8***
@@ -125,7 +125,7 @@
 
 // Make sure that the instantiated constructor initializes start and
 // end properly.
-// CHECK: define linkonce_odr void @_ZN1XIiEC2ERKS0_
+// CHECK: define linkonce_odr unnamed_addr void @_ZN1XIiEC2ERKS0_
 // CHECK: {{store.*null}}
 // CHECK: {{store.*null}}
 // CHECK: ret
diff --git a/test/CodeGenCXX/constructors.cpp b/test/CodeGenCXX/constructors.cpp
index a8dc7fc..8a8eedf 100644
--- a/test/CodeGenCXX/constructors.cpp
+++ b/test/CodeGenCXX/constructors.cpp
@@ -21,18 +21,18 @@
 A::A(struct Undeclared &ref) : mem(0) {}
 
 // Check that delegation works.
-// CHECK: define void @_ZN1AC1ER10Undeclared(
+// CHECK: define unnamed_addr void @_ZN1AC1ER10Undeclared(
 // CHECK: call void @_ZN1AC2ER10Undeclared(
 
-// CHECK: define void @_ZN1AC2ER10Undeclared(
+// CHECK: define unnamed_addr void @_ZN1AC2ER10Undeclared(
 // CHECK: call void @_ZN6MemberC1Ei(
 
 A::A(ValueClass v) : mem(v.y - v.x) {}
 
-// CHECK: define void @_ZN1AC1E10ValueClass(
+// CHECK: define unnamed_addr void @_ZN1AC1E10ValueClass(
 // CHECK: call void @_ZN1AC2E10ValueClass(
 
-// CHECK: define void @_ZN1AC2E10ValueClass(
+// CHECK: define unnamed_addr void @_ZN1AC2E10ValueClass(
 // CHECK: call void @_ZN6MemberC1Ei(
 
 
@@ -44,10 +44,10 @@
 
 B::B(struct Undeclared &ref) : A(ref), mem(1) {}
 
-// CHECK: define void @_ZN1BC1ER10Undeclared(
+// CHECK: define unnamed_addr void @_ZN1BC1ER10Undeclared(
 // CHECK: call void @_ZN1BC2ER10Undeclared(
 
-// CHECK: define void @_ZN1BC2ER10Undeclared(
+// CHECK: define unnamed_addr void @_ZN1BC2ER10Undeclared(
 // CHECK: call void @_ZN1AC2ER10Undeclared(
 // CHECK: call void @_ZN6MemberC1Ei(
 
@@ -64,12 +64,12 @@
 };
 C::C(int x) : A(ValueClass(x, x+1)), mem(x * x) {}
 
-// CHECK: define void @_ZN1CC1Ei(
+// CHECK: define unnamed_addr void @_ZN1CC1Ei(
 // CHECK: call void @_ZN10ValueClassC1Eii(
 // CHECK: call void @_ZN1AC2E10ValueClass(
 // CHECK: call void @_ZN6MemberC1Ei(
 
-// CHECK: define void @_ZN1CC2Ei(
+// CHECK: define unnamed_addr void @_ZN1CC2Ei(
 // CHECK: call void @_ZN6MemberC1Ei(
 
 
@@ -83,12 +83,12 @@
 
 D::D(int x, ...) : A(ValueClass(x, x+1)), mem(x*x) {}
 
-// CHECK: define void @_ZN1DC1Eiz(
+// CHECK: define unnamed_addr void @_ZN1DC1Eiz(
 // CHECK: call void @_ZN10ValueClassC1Eii(
 // CHECK: call void @_ZN1AC2E10ValueClass(
 // CHECK: call void @_ZN6MemberC1Ei(
 
-// CHECK: define void @_ZN1DC2Eiz(
+// CHECK: define unnamed_addr void @_ZN1DC2Eiz(
 // CHECK: call void @_ZN10ValueClassC1Eii(
 // CHECK: call void @_ZN1AC2E10ValueClass(
 // CHECK: call void @_ZN6MemberC1Ei(
diff --git a/test/CodeGenCXX/copy-constructor-elim-2.cpp b/test/CodeGenCXX/copy-constructor-elim-2.cpp
index 563676f..69d004b 100644
--- a/test/CodeGenCXX/copy-constructor-elim-2.cpp
+++ b/test/CodeGenCXX/copy-constructor-elim-2.cpp
@@ -21,7 +21,7 @@
     Derived(const Other &O);
   };
 
-  // CHECK: define void @_ZN13no_elide_base7DerivedC1ERKNS_5OtherE
+  // CHECK: define unnamed_addr void @_ZN13no_elide_base7DerivedC1ERKNS_5OtherE
   Derived::Derived(const Other &O) 
     // CHECK: call void @_ZNK13no_elide_base5OthercvNS_4BaseEEv
     // CHECK: call void @_ZN13no_elide_base4BaseC2ERKS0_
diff --git a/test/CodeGenCXX/copy-constructor-synthesis-2.cpp b/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
index 2f7c79b..406769a 100644
--- a/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
+++ b/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
@@ -3,5 +3,5 @@
 struct A { virtual void a(); };
 A x(A& y) { return y; }
 
-// CHECK: define linkonce_odr void @_ZN1AC1ERKS_(
+// CHECK: define linkonce_odr unnamed_addr void @_ZN1AC1ERKS_(
 // CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2)
diff --git a/test/CodeGenCXX/copy-constructor-synthesis.cpp b/test/CodeGenCXX/copy-constructor-synthesis.cpp
index 9cafd0a..9670e82 100644
--- a/test/CodeGenCXX/copy-constructor-synthesis.cpp
+++ b/test/CodeGenCXX/copy-constructor-synthesis.cpp
@@ -21,7 +21,7 @@
 };
 
 
-// CHECK: define linkonce_odr void @_ZN1XC1ERKS_
+// CHECK: define linkonce_odr unnamed_addr void @_ZN1XC1ERKS_
 struct X  : M, N, P { // ...
   X() : f1(1.0), d1(2.0), i1(3), name("HELLO"), bf1(0xff), bf2(0xabcd),
         au_i1(1234), au1_4("MASKED") {}
@@ -136,7 +136,7 @@
   B b2 = b1;
 }
 
-// CHECK: define linkonce_odr void @_ZN6PR66281BC2ERKS0_
+// CHECK: define linkonce_odr unnamed_addr void @_ZN6PR66281BC2ERKS0_
 // CHECK: call void @_ZN6PR66281TC1Ev
 // CHECK: call void @_ZN6PR66281TC1Ev
 // CHECK: call void @_ZN6PR66281AC2ERKS0_RKNS_1TES5_
diff --git a/test/CodeGenCXX/default-arg-temps.cpp b/test/CodeGenCXX/default-arg-temps.cpp
index c441985..5aeb7af 100644
--- a/test/CodeGenCXX/default-arg-temps.cpp
+++ b/test/CodeGenCXX/default-arg-temps.cpp
@@ -61,7 +61,7 @@
     C c;
     A a;
 
-    // CHECK: define linkonce_odr void @_ZN5test11DC2Ev(
+    // CHECK: define linkonce_odr unnamed_addr void @_ZN5test11DC2Ev(
     // CHECK:      call void @_ZN5test11BC1Ev(
     // CHECK-NEXT: call void @_ZN5test11CC1ERKNS_1BE(
     // CHECK-NEXT: call void @_ZN5test11BD1Ev(
diff --git a/test/CodeGenCXX/default-arguments.cpp b/test/CodeGenCXX/default-arguments.cpp
index 2ed1567..fdcf033 100644
--- a/test/CodeGenCXX/default-arguments.cpp
+++ b/test/CodeGenCXX/default-arguments.cpp
@@ -42,10 +42,10 @@
  C();
 };
 
-// CHECK: define void @_ZN1CC1Ev(
+// CHECK: define unnamed_addr void @_ZN1CC1Ev(
 // CHECK: call void @_ZN1CC2Ev(
 
-// CHECK: define void @_ZN1CC2Ev(
+// CHECK: define unnamed_addr void @_ZN1CC2Ev(
 // CHECK: call void @_ZN2A1C1Ev(
 // CHECK: call void @_ZN2A2C1Ev(
 // CHECK: call void @_ZN1BC1ERK2A1RK2A2(
diff --git a/test/CodeGenCXX/default-constructor-template-member.cpp b/test/CodeGenCXX/default-constructor-template-member.cpp
index e74fb6d..284fb20 100644
--- a/test/CodeGenCXX/default-constructor-template-member.cpp
+++ b/test/CodeGenCXX/default-constructor-template-member.cpp
@@ -6,5 +6,5 @@
   B b;
 }
 // CHECK: call void @_ZN1BC1Ev
-// CHECK: define linkonce_odr void @_ZN1BC1Ev
+// CHECK: define linkonce_odr unnamed_addr void @_ZN1BC1Ev
 // CHECK: call void @_ZN1AIiEC1Ev
diff --git a/test/CodeGenCXX/delete.cpp b/test/CodeGenCXX/delete.cpp
index b8726a8..965fbe3 100644
--- a/test/CodeGenCXX/delete.cpp
+++ b/test/CodeGenCXX/delete.cpp
@@ -54,7 +54,7 @@
     delete a;
   }
 
-  // CHECK: define linkonce_odr void @_ZN5test01AD1Ev
+  // CHECK: define linkonce_odr unnamed_addr void @_ZN5test01AD1Ev
   // CHECK: define linkonce_odr void @_ZN5test01AdlEPv
 }
 
diff --git a/test/CodeGenCXX/destructors.cpp b/test/CodeGenCXX/destructors.cpp
index 2eba30f..6c61367 100644
--- a/test/CodeGenCXX/destructors.cpp
+++ b/test/CodeGenCXX/destructors.cpp
@@ -40,11 +40,11 @@
 
   struct allocator_derived : allocator { };
 
-  // CHECK: define void @_ZN6PR75269allocatorD2Ev
+  // CHECK: define unnamed_addr void @_ZN6PR75269allocatorD2Ev
   // CHECK: call void @__cxa_call_unexpected
   allocator::~allocator() throw() { foo(); }
 
-  // CHECK: define linkonce_odr void @_ZN6PR752617allocator_derivedD1Ev
+  // CHECK: define linkonce_odr unnamed_addr void @_ZN6PR752617allocator_derivedD1Ev
   // CHECK-NOT: call void @__cxa_call_unexpected
   // CHECK:     }
   void foo() {
@@ -93,7 +93,7 @@
 
 // complete destructor alias tested above
 
-// CHECK: define void @_ZN5test01AD2Ev
+// CHECK: define unnamed_addr void @_ZN5test01AD2Ev
 // CHECK: invoke void @_ZN5test06MemberD1Ev
 // CHECK:   unwind label [[MEM_UNWIND:%[a-zA-Z0-9.]+]]
 // CHECK: invoke void @_ZN5test04BaseD2Ev
@@ -106,7 +106,7 @@
   B::~B() try { } catch (int i) {}
   // It will suppress the delegation optimization here, though.
 
-// CHECK: define void @_ZN5test01BD1Ev
+// CHECK: define unnamed_addr void @_ZN5test01BD1Ev
 // CHECK: invoke void @_ZN5test06MemberD1Ev
 // CHECK:   unwind label [[MEM_UNWIND:%[a-zA-Z0-9.]+]]
 // CHECK: invoke void @_ZN5test04BaseD2Ev
@@ -114,7 +114,7 @@
 // CHECK: invoke void @_ZN5test05VBaseD2Ev
 // CHECK:   unwind label [[VBASE_UNWIND:%[a-zA-Z0-9.]+]]
 
-// CHECK: define void @_ZN5test01BD2Ev
+// CHECK: define unnamed_addr void @_ZN5test01BD2Ev
 // CHECK: invoke void @_ZN5test06MemberD1Ev
 // CHECK:   unwind label [[MEM_UNWIND:%[a-zA-Z0-9.]+]]
 // CHECK: invoke void @_ZN5test04BaseD2Ev
@@ -142,24 +142,24 @@
   O::~O() {} // alias tested above
 
   struct P : NonEmpty, A { ~P(); };
-  P::~P() {} // CHECK: define void @_ZN5test11PD2Ev
+  P::~P() {} // CHECK: define unnamed_addr void @_ZN5test11PD2Ev
 
   struct Q : A, B { ~Q(); };
-  Q::~Q() {} // CHECK: define void @_ZN5test11QD2Ev
+  Q::~Q() {} // CHECK: define unnamed_addr void @_ZN5test11QD2Ev
 
   struct R : A { ~R(); };
-  R::~R() { A a; } // CHECK: define void @_ZN5test11RD2Ev
+  R::~R() { A a; } // CHECK: define unnamed_addr void @_ZN5test11RD2Ev
 
   struct S : A { ~S(); int x; };
   S::~S() {} // alias tested above
 
   struct T : A { ~T(); B x; };
-  T::~T() {} // CHECK: define void @_ZN5test11TD2Ev
+  T::~T() {} // CHECK: define unnamed_addr void @_ZN5test11TD2Ev
 
   // The VTT parameter prevents this.  We could still make this work
   // for calling conventions that are safe against extra parameters.
   struct U : A, virtual B { ~U(); };
-  U::~U() {} // CHECK: define void @_ZN5test11UD2Ev
+  U::~U() {} // CHECK: define unnamed_addr void @_ZN5test11UD2Ev
 }
 
 // PR6471
@@ -168,7 +168,7 @@
   struct B : A { ~B(); };
 
   B::~B() {}
-  // CHECK: define void @_ZN5test21BD2Ev
+  // CHECK: define unnamed_addr void @_ZN5test21BD2Ev
   // CHECK: call void @_ZN5test21AD2Ev
 }
 
@@ -273,7 +273,7 @@
   };
 
   C::C() { opaque(); }
-  // CHECK: define void @_ZN5test61CC1Ev
+  // CHECK: define unnamed_addr void @_ZN5test61CC1Ev
   // CHECK:   call void @_ZN5test61BILj2EEC2Ev
   // CHECK:   invoke void @_ZN5test61BILj3EEC2Ev
   // CHECK:   invoke void @_ZN5test61BILj0EEC2Ev
@@ -283,7 +283,7 @@
   // FIXME: way too much EH cleanup code follows
 
   C::~C() { opaque(); }
-  // CHECK: define void @_ZN5test61CD1Ev
+  // CHECK: define unnamed_addr void @_ZN5test61CD1Ev
   // CHECK:   invoke void @_ZN5test61CD2Ev
   // CHECK:   invoke void @_ZN5test61BILj3EED2Ev
   // CHECK:   call void @_ZN5test61BILj2EED2Ev
@@ -291,7 +291,7 @@
   // CHECK:   invoke void @_ZN5test61BILj3EED2Ev
   // CHECK:   invoke void @_ZN5test61BILj2EED2Ev
 
-  // CHECK: define void @_ZN5test61CD2Ev
+  // CHECK: define unnamed_addr void @_ZN5test61CD2Ev
   // CHECK:   invoke void @_ZN5test66opaqueEv
   // CHECK:   invoke void @_ZN5test61AD1Ev
   // CHECK:   invoke void @_ZN5test61AD1Ev
@@ -308,7 +308,7 @@
 
 // Checks from test3:
 
-  // CHECK: define internal void @_ZN5test312_GLOBAL__N_11DD0Ev(
+  // CHECK: define internal unnamed_addr void @_ZN5test312_GLOBAL__N_11DD0Ev(
   // CHECK: invoke void @_ZN5test312_GLOBAL__N_11DD1Ev(
   // CHECK: call void @_ZdlPv({{.*}}) nounwind
   // CHECK: ret void
@@ -330,7 +330,7 @@
   // CHECK: call void @_ZN5test312_GLOBAL__N_11DD0Ev(
   // CHECK: ret void
 
-  // CHECK: define internal void @_ZN5test312_GLOBAL__N_11CD2Ev(
+  // CHECK: define internal unnamed_addr void @_ZN5test312_GLOBAL__N_11CD2Ev(
   // CHECK: invoke void @_ZN5test31BD2Ev(
   // CHECK: call void @_ZN5test31AD2Ev(
   // CHECK: ret void
@@ -338,7 +338,7 @@
   // CHECK: declare void @_ZN5test31BD2Ev(
   // CHECK: declare void @_ZN5test31AD2Ev(
 
-  // CHECK: define internal void @_ZN5test312_GLOBAL__N_11CD0Ev(
+  // CHECK: define internal unnamed_addr void @_ZN5test312_GLOBAL__N_11CD0Ev(
   // CHECK: invoke void @_ZN5test312_GLOBAL__N_11CD1Ev(
   // CHECK: call void @_ZdlPv({{.*}}) nounwind
   // CHECK: ret void
diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp
index 0960ec3..1c529ab 100644
--- a/test/CodeGenCXX/eh.cpp
+++ b/test/CodeGenCXX/eh.cpp
@@ -197,11 +197,11 @@
 
   struct A { A(); };
 
-  // CHECK:      define void @_ZN5test91AC1Ev
+  // CHECK:      define unnamed_addr void @_ZN5test91AC1Ev
   // CHECK:      call void @_ZN5test91AC2Ev
   // CHECK-NEXT: ret void
 
-  // CHECK: define void @_ZN5test91AC2Ev(
+  // CHECK: define unnamed_addr void @_ZN5test91AC2Ev(
   A::A() try {
   // CHECK:      invoke void @_ZN5test96opaqueEv()
     opaque();
diff --git a/test/CodeGenCXX/implicit-copy-constructor.cpp b/test/CodeGenCXX/implicit-copy-constructor.cpp
index a343dd1..adc5ae5 100644
--- a/test/CodeGenCXX/implicit-copy-constructor.cpp
+++ b/test/CodeGenCXX/implicit-copy-constructor.cpp
@@ -40,7 +40,7 @@
   D d2(d);
 }
 
-// CHECK: define linkonce_odr void @_ZN1DC1ERS_
+// CHECK: define linkonce_odr unnamed_addr void @_ZN1DC1ERS_
 // CHECK: call void @_ZN1AC1Ev
 // CHECK: call void @_ZN1CC2ERS_1A
 // CHECK: call void @_ZN1AD1Ev
diff --git a/test/CodeGenCXX/mangle-subst-std.cpp b/test/CodeGenCXX/mangle-subst-std.cpp
index 9c1e978..15e88d1 100644
--- a/test/CodeGenCXX/mangle-subst-std.cpp
+++ b/test/CodeGenCXX/mangle-subst-std.cpp
@@ -14,8 +14,8 @@
 namespace std {
   struct A { A(); };
   
-  // CHECK: define void @_ZNSt1AC1Ev
-  // CHECK: define void @_ZNSt1AC2Ev
+  // CHECK: define unnamed_addr void @_ZNSt1AC1Ev
+  // CHECK: define unnamed_addr void @_ZNSt1AC2Ev
   A::A() { }
 };
 
diff --git a/test/CodeGenCXX/mangle-template.cpp b/test/CodeGenCXX/mangle-template.cpp
index 6a29944..19151f0 100644
--- a/test/CodeGenCXX/mangle-template.cpp
+++ b/test/CodeGenCXX/mangle-template.cpp
@@ -82,7 +82,7 @@
     X(U*, typename int_c<(meta<T>::value + meta<U>::value)>::type *) { }
   };
 
-  // CHECK: define weak_odr void @_ZN5test71XIiEC1IdEEPT_PNS_5int_cIXplL_ZNS_4metaIiE5valueEEsrNS6_IS3_EE5valueEE4typeE
+  // CHECK: define weak_odr unnamed_addr void @_ZN5test71XIiEC1IdEEPT_PNS_5int_cIXplL_ZNS_4metaIiE5valueEEsrNS6_IS3_EE5valueEE4typeE
   template X<int>::X(double*, float*);
 }
 
diff --git a/test/CodeGenCXX/member-functions.cpp b/test/CodeGenCXX/member-functions.cpp
index a60d24a..331b7f0 100644
--- a/test/CodeGenCXX/member-functions.cpp
+++ b/test/CodeGenCXX/member-functions.cpp
@@ -20,9 +20,9 @@
 
 
 struct S {
-  // RUN: grep "define linkonce_odr void @_ZN1SC1Ev" %t
+  // RUN: grep "define linkonce_odr unnamed_addr void @_ZN1SC1Ev" %t
   inline S() { }
-  // RUN: grep "define linkonce_odr void @_ZN1SC1Ev" %t
+  // RUN: grep "define linkonce_odr unnamed_addr void @_ZN1SC1Ev" %t
   inline ~S() { }
   
   
diff --git a/test/CodeGenCXX/member-init-assignment.cpp b/test/CodeGenCXX/member-init-assignment.cpp
index 57ab7eb..ce19e5c 100644
--- a/test/CodeGenCXX/member-init-assignment.cpp
+++ b/test/CodeGenCXX/member-init-assignment.cpp
@@ -10,7 +10,7 @@
 Foo::Foo(unsigned arg) : file_id(arg = 42)
 { }
 
-// CHECK: define void @_ZN3FooC2Ej
+// CHECK: define unnamed_addr void @_ZN3FooC2Ej
 // CHECK: [[ARG:%.*]] = alloca i32
 // CHECK: store i32 42, i32* [[ARG]]
 // CHECK: store i32 42, i32* %{{.*}}
diff --git a/test/CodeGenCXX/member-templates.cpp b/test/CodeGenCXX/member-templates.cpp
index bcf1187..4305164 100644
--- a/test/CodeGenCXX/member-templates.cpp
+++ b/test/CodeGenCXX/member-templates.cpp
@@ -15,8 +15,8 @@
 
 template<typename T> B::B(T) {}
 
-// CHECK: define weak_odr void @_ZN1BC1IiEET_(%struct.B* %this, i32)
-// CHECK: define weak_odr void @_ZN1BC2IiEET_(%struct.B* %this, i32)
+// CHECK: define weak_odr unnamed_addr void @_ZN1BC1IiEET_(%struct.B* %this, i32)
+// CHECK: define weak_odr unnamed_addr void @_ZN1BC2IiEET_(%struct.B* %this, i32)
 template B::B(int);
 
 template<typename T>
diff --git a/test/CodeGenCXX/pointers-to-data-members.cpp b/test/CodeGenCXX/pointers-to-data-members.cpp
index 41c76d0..0029659 100644
--- a/test/CodeGenCXX/pointers-to-data-members.cpp
+++ b/test/CodeGenCXX/pointers-to-data-members.cpp
@@ -120,7 +120,7 @@
   A();
 };
 
-// CHECK: define void @_ZN9ValueInit1AC2Ev
+// CHECK: define unnamed_addr void @_ZN9ValueInit1AC2Ev
 // CHECK: store i64 -1, i64*
 // CHECK: ret void
 A::A() : a() {}
diff --git a/test/CodeGenCXX/template-anonymous-types.cpp b/test/CodeGenCXX/template-anonymous-types.cpp
index 5e7a71f..a756779 100644
--- a/test/CodeGenCXX/template-anonymous-types.cpp
+++ b/test/CodeGenCXX/template-anonymous-types.cpp
@@ -29,9 +29,9 @@
   //
   // BAR's instantiation of X:
   // CHECK: define internal i32 @"_ZN1XIN1S3$_1EE1fEv"(%struct.X* %this)
-  // CHECK: define internal void @"_ZN1XIN1S3$_1EEC2ES1_"(%struct.X* %this, i32 %t)
+  // CHECK: define internal unnamed_addr void @"_ZN1XIN1S3$_1EEC2ES1_"(%struct.X* %this, i32 %t)
   //
   // FOO's instantiation of X:
   // CHECK: define internal i32 @"_ZN1XIN1S3$_0EE1fEv"(%struct.X* %this)
-  // CHECK: define internal void @"_ZN1XIN1S3$_0EEC2ES1_"(%struct.X* %this, i32 %t)
+  // CHECK: define internal unnamed_addr void @"_ZN1XIN1S3$_0EEC2ES1_"(%struct.X* %this, i32 %t)
 }
diff --git a/test/CodeGenCXX/template-instantiation.cpp b/test/CodeGenCXX/template-instantiation.cpp
index 0df2e23..89ad7e7 100644
--- a/test/CodeGenCXX/template-instantiation.cpp
+++ b/test/CodeGenCXX/template-instantiation.cpp
@@ -7,7 +7,7 @@
 // CHECK-NOT: _ZTVN5test31SIiEE
 // CHECK-NOT: _ZTSN5test31SIiEE
 
-// CHECK: define linkonce_odr void @_ZN5test21CIiEC1Ev(
+// CHECK: define linkonce_odr unnamed_addr void @_ZN5test21CIiEC1Ev(
 // CHECK: define linkonce_odr void @_ZN5test21CIiE6foobarIdEEvT_(
 // CHECK: define available_externally void @_ZN5test21CIiE6zedbarEd(
 
diff --git a/test/CodeGenCXX/template-linkage.cpp b/test/CodeGenCXX/template-linkage.cpp
index 63a5c09..ae0a6bd 100644
--- a/test/CodeGenCXX/template-linkage.cpp
+++ b/test/CodeGenCXX/template-linkage.cpp
@@ -37,7 +37,7 @@
 extern template struct X0<char>;
 extern template struct X1<char>;
 
-// CHECK: define linkonce_odr void @_ZN2X1IcED1Ev(
+// CHECK: define linkonce_odr unnamed_addr void @_ZN2X1IcED1Ev(
 void test_X1() {
   X1<char> i1c;
 }
diff --git a/test/CodeGenCXX/value-init.cpp b/test/CodeGenCXX/value-init.cpp
index 0d091cd..a0dbf0e 100644
--- a/test/CodeGenCXX/value-init.cpp
+++ b/test/CodeGenCXX/value-init.cpp
@@ -133,7 +133,7 @@
     X3<int>().f();
   }
 
-  // CHECK: define linkonce_odr void @_ZN8zeroinit2X3IiEC2Ev
+  // CHECK: define linkonce_odr unnamed_addr void @_ZN8zeroinit2X3IiEC2Ev
   // CHECK: call void @llvm.memset.p0i8.i64
   // CHECK-NEXT: call void @_ZN8zeroinit2X2IiEC2Ev
   // CHECK-NEXT: ret void
diff --git a/test/CodeGenCXX/virt-dtor-gen.cpp b/test/CodeGenCXX/virt-dtor-gen.cpp
index a4346ba..cb418f8 100644
--- a/test/CodeGenCXX/virt-dtor-gen.cpp
+++ b/test/CodeGenCXX/virt-dtor-gen.cpp
@@ -7,4 +7,4 @@
 };
 Foo::~Foo() {}
 
-// CHECK: define void @_ZN3FooD0Ev
+// CHECK: define unnamed_addr void @_ZN3FooD0Ev
diff --git a/test/CodeGenCXX/virtual-base-destructor-call.cpp b/test/CodeGenCXX/virtual-base-destructor-call.cpp
index 4618a03..a22be43 100644
--- a/test/CodeGenCXX/virtual-base-destructor-call.cpp
+++ b/test/CodeGenCXX/virtual-base-destructor-call.cpp
@@ -18,34 +18,34 @@
 
 // basic_iostream's complete dtor calls its base dtor, then its
 // virtual base's dtor.
-//  CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED1Ev
+//  CHECK: define linkonce_odr unnamed_addr void @_ZN14basic_iostreamIcED1Ev
 //  CHECK: call void @_ZN14basic_iostreamIcED2Ev
 //  CHECK: call void @_ZN9basic_iosD2Ev
 
 // basic_iostream's base dtor calls its non-virtual base dtor.
-//  CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED2Ev
+//  CHECK: define linkonce_odr unnamed_addr void @_ZN14basic_iostreamIcED2Ev
 //  CHECK: call void @_ZN13basic_istreamIcED2Ev
 //  CHECK: }
 
 // basic_istream's base dtor is a no-op.
-//  CHECK: define linkonce_odr void @_ZN13basic_istreamIcED2Ev
+//  CHECK: define linkonce_odr unnamed_addr void @_ZN13basic_istreamIcED2Ev
 //  CHECK-NOT: call
 //  CHECK: }
 
 // basic_iostream's deleting dtor calls its complete dtor, then
 // operator delete().
-//  CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED0Ev
+//  CHECK: define linkonce_odr unnamed_addr void @_ZN14basic_iostreamIcED0Ev
 //  CHECK: call void @_ZN14basic_iostreamIcED1Ev
 //  CHECK: call void @_ZdlPv
 
 // basic_istream's complete dtor calls the base dtor,
 // then its virtual base's base dtor.
-//  CHECK: define linkonce_odr void @_ZN13basic_istreamIcED1Ev
+//  CHECK: define linkonce_odr unnamed_addr void @_ZN13basic_istreamIcED1Ev
 //  CHECK: call void @_ZN13basic_istreamIcED2Ev
 //  CHECK: call void @_ZN9basic_iosD2Ev
 
 // basic_istream's deleting dtor calls the complete dtor, then
 // operator delete().
-//  CHECK: define linkonce_odr void @_ZN13basic_istreamIcED0Ev
+//  CHECK: define linkonce_odr unnamed_addr void @_ZN13basic_istreamIcED0Ev
 //  CHECK: call void @_ZN13basic_istreamIcED1Ev
 //  CHECK: call void @_ZdlPv
diff --git a/test/CodeGenCXX/virtual-bases.cpp b/test/CodeGenCXX/virtual-bases.cpp
index 61de315..21f3813 100644
--- a/test/CodeGenCXX/virtual-bases.cpp
+++ b/test/CodeGenCXX/virtual-bases.cpp
@@ -5,23 +5,23 @@
 };
 
 // CHECK: @_ZN1AC1Ev = alias {{.*}} @_ZN1AC2Ev
-// CHECK: define void @_ZN1AC2Ev(%struct.A* %this)
+// CHECK: define unnamed_addr void @_ZN1AC2Ev(%struct.A* %this)
 A::A() { }
 
 struct B : virtual A { 
   B();
 };
 
-// CHECK: define void @_ZN1BC1Ev(%struct.B* %this)
-// CHECK: define void @_ZN1BC2Ev(%struct.B* %this, i8** %vtt)
+// CHECK: define unnamed_addr void @_ZN1BC1Ev(%struct.B* %this)
+// CHECK: define unnamed_addr void @_ZN1BC2Ev(%struct.B* %this, i8** %vtt)
 B::B() { }
 
 struct C : virtual A {
   C(bool);
 };
 
-// CHECK: define void @_ZN1CC1Eb(%struct.B* %this, i1 zeroext)
-// CHECK: define void @_ZN1CC2Eb(%struct.B* %this, i8** %vtt, i1 zeroext)
+// CHECK: define unnamed_addr void @_ZN1CC1Eb(%struct.B* %this, i1 zeroext)
+// CHECK: define unnamed_addr void @_ZN1CC2Eb(%struct.B* %this, i8** %vtt, i1 zeroext)
 C::C(bool) { }
 
 // PR6251
@@ -39,7 +39,7 @@
   D();
 };
 
-// CHECK: define void @_ZN6PR62511DC1Ev
+// CHECK: define unnamed_addr void @_ZN6PR62511DC1Ev
 // CHECK: call void @_ZN6PR62511AIcEC2Ev
 // CHECK-NOT: call void @_ZN6PR62511AIcEC2Ev
 // CHECK: ret void
diff --git a/test/CodeGenCXX/virtual-destructor-calls.cpp b/test/CodeGenCXX/virtual-destructor-calls.cpp
index c5b9262..501f760 100644
--- a/test/CodeGenCXX/virtual-destructor-calls.cpp
+++ b/test/CodeGenCXX/virtual-destructor-calls.cpp
@@ -21,12 +21,12 @@
 // CHECK: @_ZN1CD2Ev = alias bitcast {{.*}} @_ZN1BD2Ev
 
 // Deleting dtor: defers to the complete dtor.
-// CHECK: define void @_ZN1BD0Ev
+// CHECK: define unnamed_addr void @_ZN1BD0Ev
 // CHECK: call void @_ZN1BD1Ev
 // CHECK: call void @_ZdlPv
 
 // Base dtor: actually calls A's base dtor.
-// CHECK: define void @_ZN1BD2Ev
+// CHECK: define unnamed_addr void @_ZN1BD2Ev
 // CHECK: call void @_ZN6MemberD1Ev
 // CHECK: call void @_ZN1AD2Ev
 
@@ -41,7 +41,7 @@
 // Complete dtor: just an alias (checked above).
 
 // Deleting dtor: defers to the complete dtor.
-// CHECK: define void @_ZN1CD0Ev
+// CHECK: define unnamed_addr void @_ZN1CD0Ev
 // CHECK: call void @_ZN1CD1Ev
 // CHECK: call void @_ZdlPv
 
diff --git a/test/CodeGenCXX/vtable-pointer-initialization.cpp b/test/CodeGenCXX/vtable-pointer-initialization.cpp
index 75620ab..c0d7d82 100644
--- a/test/CodeGenCXX/vtable-pointer-initialization.cpp
+++ b/test/CodeGenCXX/vtable-pointer-initialization.cpp
@@ -19,14 +19,14 @@
   Field field;
 };
 
-// CHECK: define void @_ZN1AC2Ev(
+// CHECK: define unnamed_addr void @_ZN1AC2Ev(
 // CHECK: call void @_ZN4BaseC2Ev(
 // CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2)
 // CHECK: call void @_ZN5FieldC1Ev(
 // CHECK: ret void
 A::A() { }
 
-// CHECK: define void @_ZN1AD2Ev(
+// CHECK: define unnamed_addr void @_ZN1AD2Ev(
 // CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2)
 // CHECK: call void @_ZN5FieldD1Ev(
 // CHECK: call void @_ZN4BaseD2Ev(
@@ -41,16 +41,16 @@
 
 void f() { B b; }
 
-// CHECK: define linkonce_odr void @_ZN1BC1Ev(
+// CHECK: define linkonce_odr unnamed_addr void @_ZN1BC1Ev(
 // CHECK: call void @_ZN1BC2Ev(
 
-// CHECK: define linkonce_odr void @_ZN1BD1Ev(
+// CHECK: define linkonce_odr unnamed_addr void @_ZN1BD1Ev(
 // CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1B, i64 0, i64 2)
 // CHECK: call void @_ZN5FieldD1Ev(
 // CHECK: call void @_ZN4BaseD2Ev(
 // CHECK: ret void
 
-// CHECK: define linkonce_odr void @_ZN1BC2Ev(
+// CHECK: define linkonce_odr unnamed_addr void @_ZN1BC2Ev(
 // CHECK: call void @_ZN4BaseC2Ev(
 // CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1B, i64 0, i64 2)
 // CHECK: call void @_ZN5FieldC1Ev
diff --git a/test/CodeGenObjCXX/implicit-copy-constructor.mm b/test/CodeGenObjCXX/implicit-copy-constructor.mm
index 489fd97..d9ed55f 100644
--- a/test/CodeGenObjCXX/implicit-copy-constructor.mm
+++ b/test/CodeGenObjCXX/implicit-copy-constructor.mm
@@ -41,7 +41,7 @@
   D d2(d);
 }
 
-// CHECK: define linkonce_odr void @_ZN1DC1ERS_
+// CHECK: define linkonce_odr unnamed_addr void @_ZN1DC1ERS_
 // CHECK: call void @_ZN1AC1Ev
 // CHECK: call void @_ZN1CC2ERS_1A
 // CHECK: call void @_ZN1AD1Ev