Skip to content

Commit d6fad59

Browse files
committed
[ValueTracking] Adjust evaluation order
1 parent 551aebd commit d6fad59

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3756,17 +3756,17 @@ static bool isKnownNonEqual(const Value *V1, const Value *V2,
37563756
for (BranchInst *BI : Q.DC->conditionsFor(V1)) {
37573757
Value *Cond = BI->getCondition();
37583758
BasicBlockEdge Edge0(BI->getParent(), BI->getSuccessor(0));
3759-
if (isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
3759+
if (Q.DT->dominates(Edge0, Q.CxtI->getParent()) &&
3760+
isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
37603761
/*LHSIsTrue=*/true, Depth)
3761-
.value_or(false) &&
3762-
Q.DT->dominates(Edge0, Q.CxtI->getParent()))
3762+
.value_or(false))
37633763
return true;
37643764

37653765
BasicBlockEdge Edge1(BI->getParent(), BI->getSuccessor(1));
3766-
if (isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
3766+
if (Q.DT->dominates(Edge1, Q.CxtI->getParent()) &&
3767+
isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
37673768
/*LHSIsTrue=*/false, Depth)
3768-
.value_or(false) &&
3769-
Q.DT->dominates(Edge1, Q.CxtI->getParent()))
3769+
.value_or(false))
37703770
return true;
37713771
}
37723772
}

0 commit comments

Comments
 (0)