[llvm-commits] [poolalloc] r125834 - /poolalloc/trunk/lib/AssistDS/MergeGEP.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Fri Feb 18 07:39:21 PST 2011


Author: aggarwa4
Date: Fri Feb 18 09:39:21 2011
New Revision: 125834

URL: http://llvm.org/viewvc/llvm-project?rev=125834&view=rev
Log:
Merge GEPs with single use, even if they are 
not struct type.

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

Modified: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/MergeGEP.cpp?rev=125834&r1=125833&r2=125834&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/MergeGEP.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Fri Feb 18 09:39:21 2011
@@ -35,7 +35,7 @@
       bool changed = false;
       bool found;
       do {
-        found = false;
+      found = false;
       for (Module::iterator F = M.begin(); F != M.end(); ++F){
         for (Function::iterator B = F->begin(), FE = F->end(); B != FE; ++B) {      
           for (BasicBlock::iterator I = B->begin(), BE = B->end(); I != BE; I++) {
@@ -44,11 +44,6 @@
             GetElementPtrInst *GEP = cast<GetElementPtrInst>(I);
             if(!isa<ArrayType>(GEP->getType()->getElementType()))
               continue;
-            for (gep_type_iterator I = gep_type_begin(GEP), E = gep_type_end(GEP);
-                 I != E; ++I) {
-              if (isa<StructType>(*I)) {
-                gep_type_iterator II = I;
-                if(++II == E){
                   std::vector<GetElementPtrInst*> worklist;
                   for (Value::use_iterator UI = GEP->use_begin(),
                                      UE = GEP->use_end(); UI != UE; ++UI){
@@ -73,9 +68,6 @@
                     found = true;
                     changed = true;                    
                   }
-                }
-              }
-            }
           }
         }
       std::vector<GetElementPtrInst*> worklist;
@@ -106,8 +98,6 @@
                                                               Indices.end(),
                                                               GEP->getName()+ "mod", 
                                                               GEP);
-        //GEP->dump();
-        //GEPNew->dump();
         GEP->replaceAllUsesWith(GEPNew);
         GEP->eraseFromParent();
         changed = true;                    





More information about the llvm-commits mailing list