[llvm-commits] [poolalloc] r126407 - /poolalloc/trunk/lib/AssistDS/IndCloner.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Thu Feb 24 11:28:32 PST 2011


Author: aggarwa4
Date: Thu Feb 24 13:28:32 2011
New Revision: 126407

URL: http://llvm.org/viewvc/llvm-project?rev=126407&view=rev
Log:
Adjust the iterator.

Modified:
    poolalloc/trunk/lib/AssistDS/IndCloner.cpp

Modified: poolalloc/trunk/lib/AssistDS/IndCloner.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/IndCloner.cpp?rev=126407&r1=126406&r2=126407&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/IndCloner.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/IndCloner.cpp Thu Feb 24 13:28:32 2011
@@ -74,6 +74,7 @@
       for (Value::use_iterator ui = I->use_begin(), ue = I->use_end();
           ui != ue; ++ui) {
         if (!isa<CallInst>(ui) && !isa<InvokeInst>(ui)) {
+          if(!ui->use_empty())
           //
           // If this function is used for anything other than a direct function
           // call, then we want to clone it.
@@ -146,8 +147,10 @@
     //
     for (Value::use_iterator ui = Original->use_begin(),
                              ue = Original->use_end();
-        ui != ue; ++ui) {
-      if (CallInst* CI = dyn_cast<CallInst>(ui)) {
+        ui != ue; ) {
+      CallInst *CI = dyn_cast<CallInst>(ui);
+      ui++;
+      if (CI) {
         if (CI->getOperand(0) == Original) {
           ++numReplaced;
           CI->setOperand(0, DirectF);





More information about the llvm-commits mailing list