Micro-optimize GroupByComplexity.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112431 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2010-08-29 15:07:13 +00:00
parent 0f32ae3aa7
commit c6a8e99fb3

View File

@ -704,8 +704,9 @@ static void GroupByComplexity(SmallVectorImpl<const SCEV *> &Ops,
if (Ops.size() == 2) {
// This is the common case, which also happens to be trivially simple.
// Special case it.
if (SCEVComplexityCompare(LI)(Ops[1], Ops[0]))
std::swap(Ops[0], Ops[1]);
const SCEV *&LHS = Ops[0], *&RHS = Ops[1];
if (SCEVComplexityCompare(LI)(RHS, LHS))
std::swap(LHS, RHS);
return;
}