Skip to content

Commit 7e0c2dd

Browse files
committed
!fixup also move logic to swap unknowns
1 parent 696b78f commit 7e0c2dd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15877,6 +15877,10 @@ void ScalarEvolution::LoopGuards::collectFromBlock(
1587715877
if (isa<SCEVConstant>(LHS)) {
1587815878
std::swap(LHS, RHS);
1587915879
Predicate = CmpInst::getSwappedPredicate(Predicate);
15880+
} else if (!isa<SCEVUnknown>(LHS) && isa<SCEVUnknown>(RHS)) {
15881+
// If RHS is SCEVUnknown, make sure the information is applied to it.
15882+
std::swap(LHS, RHS);
15883+
Predicate = CmpInst::getSwappedPredicate(Predicate);
1588015884
}
1588115885
GuardsToProcess.emplace_back(Predicate, LHS, RHS);
1588215886
continue;

0 commit comments

Comments
 (0)