diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-04-18 19:01:28 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-04-18 19:01:28 +0000 |
commit | 432c1c3fb33143b8c27bf1b505f7dcebc991eccd (patch) | |
tree | 892f9b599b3f978a7bdbf57c5fd400560b5c6891 /llvm/lib/Analysis/BranchProbabilityInfo.cpp | |
parent | a7de820a20f8c8cd2fa33703a01bf97eca4d46a5 (diff) | |
download | bcm5719-llvm-432c1c3fb33143b8c27bf1b505f7dcebc991eccd.tar.gz bcm5719-llvm-432c1c3fb33143b8c27bf1b505f7dcebc991eccd.zip |
[BPI] Consider deoptimize calls as "unreachable"
Summary:
Calls to @llvm.experimental.deoptimize are expected to "never execute",
so optimize them as such.
Reviewers: chandlerc
Subscribers: junbuml, mcrosier, llvm-commits
Differential Revision: http://reviews.llvm.org/D19095
llvm-svn: 266654
Diffstat (limited to 'llvm/lib/Analysis/BranchProbabilityInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/BranchProbabilityInfo.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp index 8512391d5ee..b431e621622 100644 --- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp +++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp @@ -115,7 +115,12 @@ static const uint32_t IH_NONTAKEN_WEIGHT = 1; bool BranchProbabilityInfo::calcUnreachableHeuristics(const BasicBlock *BB) { const TerminatorInst *TI = BB->getTerminator(); if (TI->getNumSuccessors() == 0) { - if (isa<UnreachableInst>(TI)) + if (isa<UnreachableInst>(TI) || + // If this block is terminated by a call to + // @llvm.experimental.deoptimize then treat it like an unreachable since + // the @llvm.experimental.deoptimize call is expected to practically + // never execute. + BB->getTerminatingDeoptimizeCall()) PostDominatedByUnreachable.insert(BB); return false; } |