Check for the short-circuiting condition before performing

the potentially expensive erase.

llvm-svn: 73359
This commit is contained in:
Dan Gohman 2009-06-14 22:53:57 +00:00
parent 862b7d98d1
commit 011cf687d7
1 changed files with 1 additions and 1 deletions

View File

@ -1012,8 +1012,8 @@ SCEVHandle ScalarEvolution::getAddExpr(SmallVectorImpl<SCEVHandle> &Ops) {
// We found two constants, fold them together!
Ops[0] = getConstant(LHSC->getValue()->getValue() +
RHSC->getValue()->getValue());
if (Ops.size() == 2) return Ops[0];
Ops.erase(Ops.begin()+1); // Erase the folded element
if (Ops.size() == 1) return Ops[0];
LHSC = cast<SCEVConstant>(Ops[0]);
}