[llvm-commits] [poolalloc] r135700 - /poolalloc/trunk/lib/AssistDS/TypeChecks.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Thu Jul 21 12:45:14 PDT 2011


Author: aggarwa4
Date: Thu Jul 21 14:45:14 2011
New Revision: 135700

URL: http://llvm.org/viewvc/llvm-project?rev=135700&view=rev
Log:
Fix call to replaceUsesOfWithOnConstant. See comment.

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

Modified: poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecks.cpp?rev=135700&r1=135699&r2=135700&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Thu Jul 21 14:45:14 2011
@@ -329,13 +329,18 @@
 
           //
           // Do replacements in the worklist.
-          // FIXME: I believe there is a bug here, triggered by 253.perl
-          // It works fine as long as we have only one element in ReplaceWorkist
-          // Temporary fix. Revisit.
+          // Special case for ContantArray(triggered by 253.perl)
+          // ConstantArray::replaceUsesOfWithOnConstant, replace all uses
+          // in that constant, unlike the other versions, which  only
+          // replace the use specified in ReplaceWorklist.
           //
-          //for (unsigned index = 0; index < ReplaceWorklist.size(); ++index) {
-          C->replaceUsesOfWithOnConstant(F, CNew, ReplaceWorklist[0]);
-          //}
+          if(isa<ConstantArray>(C)) {
+              C->replaceUsesOfWithOnConstant(F, CNew, ReplaceWorklist[0]);
+          } else {
+            for (unsigned index = 0; index < ReplaceWorklist.size(); ++index) {
+              C->replaceUsesOfWithOnConstant(F, CNew, ReplaceWorklist[index]);
+            }
+          }
           continue;
         }
       }
@@ -2157,7 +2162,7 @@
       /*if(isa<PHINode>(I)) {
         std::string name = PH->getName();
         if (strncmp(name.c_str(), "baseptr.", 8) == 0) continue;
-      }*/
+        }*/
       PHINode *AI_New;
       PHINode *BCI_New;
       if(!Prev) {





More information about the llvm-commits mailing list