llvm/llvm-pr9614-part2.patch

25 lines
1020 B
Diff

--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp 2011/10/28 20:43:47 143221
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp 2011/10/28 20:43:56 143222
@@ -901,18 +901,15 @@
CodeGenModule::shouldEmitFunction(const FunctionDecl *F) {
if (getFunctionLinkage(F) != llvm::Function::AvailableExternallyLinkage)
return true;
- if (F->hasAttr<AlwaysInlineAttr>())
- return true;
- if (CodeGenOpts.OptimizationLevel == 0)
+ if (CodeGenOpts.OptimizationLevel == 0 &&
+ !F->hasAttr<AlwaysInlineAttr>())
return false;
// PR9614. Avoid cases where the source code is lying to us. An available
// externally function should have an equivalent function somewhere else,
// but a function that calls itself is clearly not equivalent to the real
// implementation.
// This happens in glibc's btowc and in some configure checks.
- if (isTriviallyRecursiveViaAsm(F))
- return false;
- return true;
+ return !isTriviallyRecursiveViaAsm(F);
}
void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) {