diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-10-28 20:43:56 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-10-28 20:43:56 +0000 |
commit | cc4889f72ec68319969ba51e214d9940eb9327e5 (patch) | |
tree | 44767dcae0d5cb70ad3cc12f7d66fae698367b93 /lib/CodeGen/CodeGenModule.cpp | |
parent | 6d09f01af70bbd58ddbccb0a22f5479782b31797 (diff) |
Fix PR9614 for functions with the always_inline attribute. Try to keep
the common case (-O0, no always_inline) fast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143222 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 86378a9afa..c796e0daa9 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/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) { |