manually performing the comparison. This allows the special
case to work correctly even in the case where someone is
experimenting with a different comparison function :-).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49670
91177308-0d34-0410-b5e6-
96231b3b80d8
/// than the complexity of the RHS. This comparator is used to canonicalize
/// expressions.
struct VISIBILITY_HIDDEN SCEVComplexityCompare {
- bool operator()(SCEV *LHS, SCEV *RHS) {
+ bool operator()(const SCEV *LHS, const SCEV *RHS) const {
return LHS->getSCEVType() < RHS->getSCEVType();
}
};
if (Ops.size() == 2) {
// This is the common case, which also happens to be trivially simple.
// Special case it.
- if (Ops[0]->getSCEVType() > Ops[1]->getSCEVType())
+ if (SCEVComplexityCompare()(Ops[1], Ops[0]))
std::swap(Ops[0], Ops[1]);
return;
}