Skip to content

Commit a8d3683

Browse files
committed
[ValueTracking] Adjust evaluation order
1 parent d938637 commit a8d3683

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
@@ -3865,17 +3865,17 @@ static bool isKnownNonEqual(const Value *V1, const Value *V2,
38653865
for (BranchInst *BI : Q.DC->conditionsFor(V1)) {
38663866
Value *Cond = BI->getCondition();
38673867
BasicBlockEdge Edge0(BI->getParent(), BI->getSuccessor(0));
3868-
if (isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
3868+
if (Q.DT->dominates(Edge0, Q.CxtI->getParent()) &&
3869+
isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
38693870
/*LHSIsTrue=*/true, Depth)
3870-
.value_or(false) &&
3871-
Q.DT->dominates(Edge0, Q.CxtI->getParent()))
3871+
.value_or(false))
38723872
return true;
38733873

38743874
BasicBlockEdge Edge1(BI->getParent(), BI->getSuccessor(1));
3875-
if (isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
3875+
if (Q.DT->dominates(Edge1, Q.CxtI->getParent()) &&
3876+
isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
38763877
/*LHSIsTrue=*/false, Depth)
3877-
.value_or(false) &&
3878-
Q.DT->dominates(Edge1, Q.CxtI->getParent()))
3878+
.value_or(false))
38793879
return true;
38803880
}
38813881
}

0 commit comments

Comments
 (0)