Skip to content

Commit a3157b8

Browse files
committed
[ValueTracking] Adjust evaluation order
1 parent 931523a commit a3157b8

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
@@ -3844,17 +3844,17 @@ static bool isKnownNonEqual(const Value *V1, const Value *V2,
38443844
for (BranchInst *BI : Q.DC->conditionsFor(V1)) {
38453845
Value *Cond = BI->getCondition();
38463846
BasicBlockEdge Edge0(BI->getParent(), BI->getSuccessor(0));
3847-
if (isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
3847+
if (Q.DT->dominates(Edge0, Q.CxtI->getParent()) &&
3848+
isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
38483849
/*LHSIsTrue=*/true, Depth)
3849-
.value_or(false) &&
3850-
Q.DT->dominates(Edge0, Q.CxtI->getParent()))
3850+
.value_or(false))
38513851
return true;
38523852

38533853
BasicBlockEdge Edge1(BI->getParent(), BI->getSuccessor(1));
3854-
if (isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
3854+
if (Q.DT->dominates(Edge1, Q.CxtI->getParent()) &&
3855+
isImpliedCondition(Cond, ICmpInst::ICMP_NE, V1, V2, Q.DL,
38553856
/*LHSIsTrue=*/false, Depth)
3856-
.value_or(false) &&
3857-
Q.DT->dominates(Edge1, Q.CxtI->getParent()))
3857+
.value_or(false))
38583858
return true;
38593859
}
38603860
}

0 commit comments

Comments
 (0)