[llvm-commits] [llvm] r73359 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Dan Gohman gohman at apple.com
Sun Jun 14 15:53:58 PDT 2009


Author: djg
Date: Sun Jun 14 17:53:57 2009
New Revision: 73359

URL: http://llvm.org/viewvc/llvm-project?rev=73359&view=rev
Log:
Check for the short-circuiting condition before performing
the potentially expensive erase.

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=73359&r1=73358&r2=73359&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Jun 14 17:53:57 2009
@@ -1012,8 +1012,8 @@
       // 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]);
     }
 





More information about the llvm-commits mailing list