Speculatively revert r108156; it appears to be breaking self-host.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108194 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index d544d4c..cb83ffd 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -817,22 +817,14 @@
     if (Method->isVirtual())
       getVTables().EmitThunks(GD);
 
-  if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(D)) {
-    // At -O0, don't generate IR for functions with available_externally 
-    // linkage.
-    if (CodeGenOpts.OptimizationLevel == 0 &&
-        getFunctionLinkage(Function) 
-                                  == llvm::Function::AvailableExternallyLinkage)
-      return;
-    
-    if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(Function))
-      return EmitCXXConstructor(CD, GD.getCtorType());
+  if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(D))
+    return EmitCXXConstructor(CD, GD.getCtorType());
   
-    if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(Function))
-      return EmitCXXDestructor(DD, GD.getDtorType());
+  if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(D))
+    return EmitCXXDestructor(DD, GD.getDtorType());
 
+  if (isa<FunctionDecl>(D))
     return EmitGlobalFunctionDefinition(GD);
-  }
   
   if (const VarDecl *VD = dyn_cast<VarDecl>(D))
     return EmitGlobalVarDefinition(VD);