diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 4a695226318d..2ac6ce643c0e 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -123,12 +123,12 @@ bool SROA::runOnFunction(Function &F) { // expanded itself once the worklist is rerun. // std::string OldName = GEPI->getName(); // Steal the old name... + std::vector NewArgs; + NewArgs.push_back(Constant::getNullValue(Type::LongTy)); + NewArgs.insert(NewArgs.end(), GEPI->op_begin()+3, GEPI->op_end()); GEPI->setName(""); RepValue = - new GetElementPtrInst(AllocaToUse, - std::vector(GEPI->op_begin()+3, - GEPI->op_end()), - OldName, GEPI); + new GetElementPtrInst(AllocaToUse, NewArgs, OldName, GEPI); } // Move all of the users over to the new GEP.