[indvars] Move a check slightlly earlier [NFC]

This commit is contained in:
Philip Reames 2021-11-03 12:24:10 -07:00
parent 3fc9882e88
commit 7ff943a9ed
1 changed files with 2 additions and 2 deletions

View File

@ -1431,7 +1431,7 @@ bool IndVarSimplify::canonicalizeExitCondition(Loop *L) {
assert(BI->isConditional() && "exit branch must be conditional");
auto *ICmp = dyn_cast<ICmpInst>(BI->getCondition());
if (!ICmp || !ICmp->hasOneUse())
if (!ICmp || !ICmp->hasOneUse() || ICmp->isUnsigned())
continue;
auto *LHS = ICmp->getOperand(0);
@ -1444,7 +1444,7 @@ bool IndVarSimplify::canonicalizeExitCondition(Loop *L) {
// Match (icmp signed-cond zext, RHS)
Value *LHSOp = nullptr;
if (!match(LHS, m_ZExt(m_Value(LHSOp))) || !ICmp->isSigned())
if (!match(LHS, m_ZExt(m_Value(LHSOp))))
continue;
const DataLayout &DL = ExitingBB->getModule()->getDataLayout();