1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[NFC] Simplify check in guard widening

llvm-svn: 353290
This commit is contained in:
Max Kazantsev 2019-02-06 11:27:00 +00:00
parent f225583f53
commit 808c335569

View File

@ -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)