diff options
| author | Max Kazantsev <max.kazantsev@azul.com> | 2019-02-06 11:27:00 +0000 |
|---|---|---|
| committer | Max Kazantsev <max.kazantsev@azul.com> | 2019-02-06 11:27:00 +0000 |
| commit | cd48ac36613fe79a172e27d9f85fcbc2e3861dfa (patch) | |
| tree | 9cc372526e586fbcaf8ce835b36181c83c798648 /llvm/lib/Transforms | |
| parent | f324f6dcfba71ede8dd213096ec3b2f1b57ded86 (diff) | |
| download | bcm5719-llvm-cd48ac36613fe79a172e27d9f85fcbc2e3861dfa.tar.gz bcm5719-llvm-cd48ac36613fe79a172e27d9f85fcbc2e3861dfa.zip | |
[NFC] Simplify check in guard widening
llvm-svn: 353290
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/GuardWidening.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/GuardWidening.cpp b/llvm/lib/Transforms/Scalar/GuardWidening.cpp index d2cde52ee7e..b7988f21479 100644 --- a/llvm/lib/Transforms/Scalar/GuardWidening.cpp +++ b/llvm/lib/Transforms/Scalar/GuardWidening.cpp @@ -357,7 +357,9 @@ bool GuardWideningImpl::eliminateInstrViaWidening( const auto &GuardsInCurBB = GuardsInBlock.find(CurBB)->second; auto I = GuardsInCurBB.begin(); - auto E = GuardsInCurBB.end(); + auto E = Instr->getParent() == CurBB + ? std::find(GuardsInCurBB.begin(), GuardsInCurBB.end(), Instr) + : GuardsInCurBB.end(); #ifndef NDEBUG { @@ -375,14 +377,6 @@ bool GuardWideningImpl::eliminateInstrViaWidening( assert((i == (e - 1)) == (Instr->getParent() == CurBB) && "Bad DFS?"); - if (Instr->getParent() == CurBB && isGuard(Instr)) { - // Corner case: make sure we're only looking at guards strictly dominating - // GuardInst when visiting GuardInst->getParent(). - auto NewEnd = std::find(I, E, Instr); - assert(NewEnd != E && "GuardInst not in its own block?"); - E = NewEnd; - } - for (auto *Candidate : make_range(I, E)) { auto Score = computeWideningScore(Instr, Candidate, InvertCondition); LLVM_DEBUG(dbgs() << "Score between " << *getCondition(Instr) |

