Reinstate the optimization suppressing available_externally functions
at -O0. The only change from the previous patch is that we don't try to generate virtual method thunks for an available_externally function. llvm-svn: 108230
This commit is contained in:
@@ -813,18 +813,27 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) {
|
||||
Context.getSourceManager(),
|
||||
"Generating code for declaration");
|
||||
|
||||
if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D))
|
||||
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>(D))
|
||||
return EmitCXXConstructor(CD, GD.getCtorType());
|
||||
if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D)) {
|
||||
if (Method->isVirtual())
|
||||
getVTables().EmitThunks(GD);
|
||||
|
||||
if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(Method))
|
||||
return EmitCXXConstructor(CD, GD.getCtorType());
|
||||
|
||||
if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(D))
|
||||
return EmitCXXDestructor(DD, GD.getDtorType());
|
||||
if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(Method))
|
||||
return EmitCXXDestructor(DD, GD.getDtorType());
|
||||
}
|
||||
|
||||
if (isa<FunctionDecl>(D))
|
||||
return EmitGlobalFunctionDefinition(GD);
|
||||
}
|
||||
|
||||
if (const VarDecl *VD = dyn_cast<VarDecl>(D))
|
||||
return EmitGlobalVarDefinition(VD);
|
||||
|
||||
Reference in New Issue
Block a user