diff options
| author | Florian Hahn <florian.hahn@arm.com> | 2018-01-28 19:11:49 +0000 |
|---|---|---|
| committer | Florian Hahn <florian.hahn@arm.com> | 2018-01-28 19:11:49 +0000 |
| commit | 1636651e358968ad4844ea686bedfb0da0dd50ff (patch) | |
| tree | 7858d17cd32d0ecd21916f58d70a0970bf6ac4fd /llvm/lib | |
| parent | 77a98366ce25da5a77c4bc2fea6334411b8c5b86 (diff) | |
| download | bcm5719-llvm-1636651e358968ad4844ea686bedfb0da0dd50ff.tar.gz bcm5719-llvm-1636651e358968ad4844ea686bedfb0da0dd50ff.zip | |
[InlineCost] Mark functions accessing varargs as not viable.
This prevents functions accessing varargs from being inlined if they
have the alwaysinline attribute.
Reviewers: efriedma, rnk, davide
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D42556
llvm-svn: 323619
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/InlineCost.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index 0e7be52cae7..b0e0acd3629 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -2040,12 +2040,18 @@ bool llvm::isInlineViable(Function &F) { cast<CallInst>(CS.getInstruction())->canReturnTwice()) return false; - // Disallow inlining functions that call @llvm.localescape. Doing this - // correctly would require major changes to the inliner. - if (CS.getCalledFunction() && - CS.getCalledFunction()->getIntrinsicID() == - llvm::Intrinsic::localescape) - return false; + if (CS.getCalledFunction()) + switch (CS.getCalledFunction()->getIntrinsicID()) { + default: + break; + // Disallow inlining functions that call @llvm.localescape. Doing this + // correctly would require major changes to the inliner. + case llvm::Intrinsic::localescape: + // Disallow inlining of functions that access VarArgs. + case llvm::Intrinsic::vastart: + case llvm::Intrinsic::vaend: + return false; + } } } |

