[llvm-commits] [llvm] r107988 - /llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp

Gabor Greif ggreif at gmail.com
Fri Jul 9 09:39:03 PDT 2010


Author: ggreif
Date: Fri Jul  9 11:39:02 2010
New Revision: 107988

URL: http://llvm.org/viewvc/llvm-project?rev=107988&view=rev
Log:
cache result of operator*

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

Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=107988&r1=107987&r2=107988&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Fri Jul  9 11:39:02 2010
@@ -30,9 +30,10 @@
                                        BasicBlock::iterator IP) {
   // Check to see if there is already a cast!
   for (Value::use_iterator UI = V->use_begin(), E = V->use_end();
-       UI != E; ++UI)
-    if ((*UI)->getType() == Ty)
-      if (CastInst *CI = dyn_cast<CastInst>(cast<Instruction>(*UI)))
+       UI != E; ++UI) {
+    User *U = *UI;
+    if (U->getType() == Ty)
+      if (CastInst *CI = dyn_cast<CastInst>(cast<Instruction>(U)))
         if (CI->getOpcode() == Op) {
           // If the cast isn't where we want it, fix it.
           if (BasicBlock::iterator(CI) != IP) {
@@ -49,6 +50,7 @@
           rememberInstruction(CI);
           return CI;
         }
+  }
 
   // Create a new cast.
   Instruction *I = CastInst::Create(Op, V, Ty, V->getName(), IP);





More information about the llvm-commits mailing list