diff options
author | Dan Gohman <gohman@apple.com> | 2008-04-14 18:23:56 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-04-14 18:23:56 +0000 |
commit | f7b37b2d0e28cd2f2ecc03e3e6e470353dca5725 (patch) | |
tree | 0fc8b70da3ea4293cfa8359d7bd3593adacd6c02 /lib/Analysis/ScalarEvolution.cpp | |
parent | 63f7ba085f2ce561663656dcc81ef81ae9654358 (diff) |
In the special case, call the comparison function instead of
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
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 1b4c277e1a..4b4b97e286 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -431,7 +431,7 @@ namespace { /// 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(); } }; @@ -452,7 +452,7 @@ static void GroupByComplexity(std::vector<SCEVHandle> &Ops) { 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; } |