[llvm] r353290 - [NFC] Simplify check in guard widening
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 6 03:27:00 PST 2019
Author: mkazantsev
Date: Wed Feb 6 03:27:00 2019
New Revision: 353290
URL: http://llvm.org/viewvc/llvm-project?rev=353290&view=rev
Log:
[NFC] Simplify check in guard widening
Modified:
llvm/trunk/lib/Transforms/Scalar/GuardWidening.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/GuardWidening.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GuardWidening.cpp?rev=353290&r1=353289&r2=353290&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GuardWidening.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GuardWidening.cpp Wed Feb 6 03:27:00 2019
@@ -357,7 +357,9 @@ bool GuardWideningImpl::eliminateInstrVi
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::eliminateInstrVi
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)
More information about the llvm-commits
mailing list