[llvm-commits] [poolalloc] r109120 - /poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp

John Criswell criswell at uiuc.edu
Thu Jul 22 10:09:48 PDT 2010


Author: criswell
Date: Thu Jul 22 12:09:48 2010
New Revision: 109120

URL: http://llvm.org/viewvc/llvm-project?rev=109120&view=rev
Log:
LLVM now supports constant expressions with multiple uses.  When replacing uses
of an original function with a clone, scan through all operands of a constant
and replace those that are the old function.
This fixes a problem transforming 254.gap on Linux.

Modified:
    poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp

Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=109120&r1=109119&r2=109120&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Thu Jul 22 12:09:48 2010
@@ -248,7 +248,13 @@
       // constant because they are uniqued.
       if (Constant *C = dyn_cast<Constant>(user)) {
         if (!isa<GlobalValue>(C)) {
-          C->replaceUsesOfWithOnConstant(F, CEnew, user->op_begin());
+          for (User::op_iterator use = user->op_begin();
+               use != user->op_end();
+               ++use) {
+            if (use->get() == F) {
+              C->replaceUsesOfWithOnConstant(F, CEnew, use);
+            }
+          }
           continue;
         }
       }





More information about the llvm-commits mailing list