[llvm-commits] CVS: llvm/lib/Transforms/Utils/CodeExtractor.cpp

Chris Lattner sabre at nondot.org
Wed Jan 31 12:07:49 PST 2007



Changes in directory llvm/lib/Transforms/Utils:

CodeExtractor.cpp updated: 1.47 -> 1.48
---
Log message:

eliminate temporary vectors


---
Diffs of the changes:  (+13 -16)

 CodeExtractor.cpp |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)


Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.47 llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.48
--- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.47	Thu Jan 11 22:24:46 2007
+++ llvm/lib/Transforms/Utils/CodeExtractor.cpp	Wed Jan 31 14:07:32 2007
@@ -303,12 +303,12 @@
   for (unsigned i = 0, e = inputs.size(); i != e; ++i) {
     Value *RewriteVal;
     if (AggregateArgs) {
-      std::vector<Value*> Indices;
-      Indices.push_back(Constant::getNullValue(Type::Int32Ty));
-      Indices.push_back(ConstantInt::get(Type::Int32Ty, i));
+      Value *Idx0 = Constant::getNullValue(Type::Int32Ty);
+      Value *Idx1 = ConstantInt::get(Type::Int32Ty, i);
       std::string GEPname = "gep_" + inputs[i]->getName();
       TerminatorInst *TI = newFunction->begin()->getTerminator();
-      GetElementPtrInst *GEP = new GetElementPtrInst(AI, Indices, GEPname, TI);
+      GetElementPtrInst *GEP = new GetElementPtrInst(AI, Idx0, Idx1, 
+                                                     GEPname, TI);
       RewriteVal = new LoadInst(GEP, "load" + GEPname, TI);
     } else
       RewriteVal = AI++;
@@ -390,11 +390,10 @@
     params.push_back(Struct);
 
     for (unsigned i = 0, e = inputs.size(); i != e; ++i) {
-      std::vector<Value*> Indices;
-      Indices.push_back(Constant::getNullValue(Type::Int32Ty));
-      Indices.push_back(ConstantInt::get(Type::Int32Ty, i));
+      Value *Idx0 = Constant::getNullValue(Type::Int32Ty);
+      Value *Idx1 = ConstantInt::get(Type::Int32Ty, i);
       GetElementPtrInst *GEP =
-        new GetElementPtrInst(Struct, Indices,
+        new GetElementPtrInst(Struct, Idx0, Idx1,
                               "gep_" + StructValues[i]->getName());
       codeReplacer->getInstList().push_back(GEP);
       StoreInst *SI = new StoreInst(StructValues[i], GEP);
@@ -416,11 +415,10 @@
   for (unsigned i = 0, e = outputs.size(); i != e; ++i) {
     Value *Output = 0;
     if (AggregateArgs) {
-      std::vector<Value*> Indices;
-      Indices.push_back(Constant::getNullValue(Type::Int32Ty));
-      Indices.push_back(ConstantInt::get(Type::Int32Ty, FirstOut + i));
+      Value *Idx0 = Constant::getNullValue(Type::Int32Ty);
+      Value *Idx1 = ConstantInt::get(Type::Int32Ty, FirstOut + i);
       GetElementPtrInst *GEP
-        = new GetElementPtrInst(Struct, Indices,
+        = new GetElementPtrInst(Struct, Idx0, Idx1,
                                 "gep_reload_" + outputs[i]->getName());
       codeReplacer->getInstList().push_back(GEP);
       Output = GEP;
@@ -517,11 +515,10 @@
 
             if (DominatesDef) {
               if (AggregateArgs) {
-                std::vector<Value*> Indices;
-                Indices.push_back(Constant::getNullValue(Type::Int32Ty));
-                Indices.push_back(ConstantInt::get(Type::Int32Ty,FirstOut+out));
+                Value *Idx0 = Constant::getNullValue(Type::Int32Ty);
+                Value *Idx1 = ConstantInt::get(Type::Int32Ty,FirstOut+out);
                 GetElementPtrInst *GEP =
-                  new GetElementPtrInst(OAI, Indices,
+                  new GetElementPtrInst(OAI, Idx0, Idx1,
                                         "gep_" + outputs[out]->getName(),
                                         NTRet);
                 new StoreInst(outputs[out], GEP, NTRet);






More information about the llvm-commits mailing list