aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-10-28 20:43:56 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-10-28 20:43:56 +0000
commitfffc1ce1d7f60bf76b98c22b1af7aa0eeed51a31 (patch)
tree436363dc37657340adebf151651af721b9919fd6 /clang/lib/CodeGen/CodeGenModule.cpp
parent409b694c6c1687551658e87833c1aa6db8bdf347 (diff)
downloadllvm-fffc1ce1d7f60bf76b98c22b1af7aa0eeed51a31.zip
llvm-fffc1ce1d7f60bf76b98c22b1af7aa0eeed51a31.tar.gz
llvm-fffc1ce1d7f60bf76b98c22b1af7aa0eeed51a31.tar.bz2
Fix PR9614 for functions with the always_inline attribute. Try to keep
the common case (-O0, no always_inline) fast. llvm-svn: 143222
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 86378a9..c796e0d 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -901,18 +901,15 @@ bool
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) {