[llvm-commits] [poolalloc] r135162 - /poolalloc/trunk/lib/AssistDS/LoadArgs.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Thu Jul 14 11:08:21 PDT 2011


Author: aggarwa4
Date: Thu Jul 14 13:08:21 2011
New Revision: 135162

URL: http://llvm.org/viewvc/llvm-project?rev=135162&view=rev
Log:
Instead of passing the original pointer, pass a copy.

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

Modified: poolalloc/trunk/lib/AssistDS/LoadArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/LoadArgs.cpp?rev=135162&r1=135161&r2=135162&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/LoadArgs.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/LoadArgs.cpp Thu Jul 14 13:08:21 2011
@@ -91,7 +91,12 @@
             continue;
 
           LoadInst *LI = dyn_cast<LoadInst>(CI->getOperand(argNum));
-          if(LI->getParent() != CI->getParent())
+          Instruction * InsertPt = &(Func->getEntryBlock().front());
+          AllocaInst *NewVal = new AllocaInst(LI->getType(), "",InsertPt);
+
+          StoreInst *Copy = new StoreInst(LI, NewVal);
+          Copy->insertAfter(LI);
+          /*if(LI->getParent() != CI->getParent())
             continue;
           // Also check that there is no store after the load.
           // TODO: Check if the load/store do not alias.
@@ -109,7 +114,7 @@
           }
           if(isa<StoreInst>(bii)){
             continue;
-          }
+          }*/
 
           // Construct the new Type
           // Appends the struct Type at the beginning
@@ -124,7 +129,7 @@
           const FunctionType *NewFTy = FunctionType::get(CI->getType(), TP, false);
           numSimplified++;
           //if(numSimplified > 1000)
-            //return true;
+          //return true;
 
           Function *NewF;
           std::map<std::pair<Function*, const Type* > , Function* >::iterator Test;
@@ -184,7 +189,7 @@
           SmallVector<Value*, 8> Args;
           for(unsigned j =1;j<CI->getNumOperands();j++) {
             if(j == argNum) {
-              Args.push_back(LI->getOperand(0));
+              Args.push_back(NewVal);
             }
             Args.push_back(CI->getOperand(j));
             // position in the AttributesVec





More information about the llvm-commits mailing list