diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-01-31 20:07:32 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-01-31 20:07:32 +0000 |
| commit | 7a63e7a7ad44619ae2bd61b302b224d1fac4414b (patch) | |
| tree | fae8bd336a16027885ae1e31e86e04642f4e9f22 /llvm/lib/Transforms/Utils | |
| parent | 927653f27fa3027258a8cec0b066117429e38e60 (diff) | |
| download | bcm5719-llvm-7a63e7a7ad44619ae2bd61b302b224d1fac4414b.tar.gz bcm5719-llvm-7a63e7a7ad44619ae2bd61b302b224d1fac4414b.zip | |
eliminate temporary vectors
llvm-svn: 33713
Diffstat (limited to 'llvm/lib/Transforms/Utils')
| -rw-r--r-- | llvm/lib/Transforms/Utils/CodeExtractor.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp index e83f1b02fc6..0f35d8b2551 100644 --- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp +++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp @@ -303,12 +303,12 @@ Function *CodeExtractor::constructFunction(const Values &inputs, 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 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, 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 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, 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 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, 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); |

