aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-14 22:53:57 +0000
committerDan Gohman <gohman@apple.com>2009-06-14 22:53:57 +0000
commit68f23e8197f062e7174b4ad921d8895b6f1a5b2c (patch)
treec52e12af3060a32b92899eafc399eea76ba8c6a7 /lib/Analysis
parent56fc8f13b432829c594579e76592ab5d8c7ab6cf (diff)
downloadexternal_llvm-68f23e8197f062e7174b4ad921d8895b6f1a5b2c.zip
external_llvm-68f23e8197f062e7174b4ad921d8895b6f1a5b2c.tar.gz
external_llvm-68f23e8197f062e7174b4ad921d8895b6f1a5b2c.tar.bz2
Check for the short-circuiting condition before performing
the potentially expensive erase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73359 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index ee077d5..a2ab6e6 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -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]);
}