summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2007-08-01 03:43:44 +0000
committerDavid Greene <greened@obbligato.org>2007-08-01 03:43:44 +0000
commit17a5dfe6f7c93bcfe69cf8b6cfe4ae5fce39cd95 (patch)
tree3e5f4a9ad5f1f547e915d12b7299a6365648cba8 /llvm/tools
parentbf2f38693e23759931c387222ed8636ecbe2f2e0 (diff)
downloadbcm5719-llvm-17a5dfe6f7c93bcfe69cf8b6cfe4ae5fce39cd95.tar.gz
bcm5719-llvm-17a5dfe6f7c93bcfe69cf8b6cfe4ae5fce39cd95.zip
New CallInst interface to address GLIBCXX_DEBUG errors caused by
indexing an empty std::vector. Updates to all clients. llvm-svn: 40660
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/bugpoint/Miscompilation.cpp10
-rw-r--r--llvm/tools/llvm-upgrade/UpgradeParser.y17
2 files changed, 14 insertions, 13 deletions
diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp
index 925a7a85ee9..be820c8b284 100644
--- a/llvm/tools/bugpoint/Miscompilation.cpp
+++ b/llvm/tools/bugpoint/Miscompilation.cpp
@@ -663,7 +663,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test,
// Call the old main function and return its result
BasicBlock *BB = new BasicBlock("entry", newMain);
- CallInst *call = new CallInst(oldMainProto, &args[0], args.size(),
+ CallInst *call = new CallInst(oldMainProto, args.begin(), args.end(),
"", BB);
// If the type of old function wasn't void, return value of call
@@ -734,8 +734,8 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test,
// Resolve the call to function F via the JIT API:
//
// call resolver(GetElementPtr...)
- CallInst *Resolver = new CallInst(resolverFunc, &ResolverArgs[0],
- ResolverArgs.size(),
+ CallInst *Resolver = new CallInst(resolverFunc, ResolverArgs.begin(),
+ ResolverArgs.end(),
"resolver", LookupBB);
// cast the result from the resolver to correctly-typed function
CastInst *CastedResolver = new BitCastInst(Resolver,
@@ -757,10 +757,10 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test,
// Pass on the arguments to the real function, return its result
if (F->getReturnType() == Type::VoidTy) {
- new CallInst(FuncPtr, &Args[0], Args.size(), "", DoCallBB);
+ new CallInst(FuncPtr, Args.begin(), Args.end(), "", DoCallBB);
new ReturnInst(DoCallBB);
} else {
- CallInst *Call = new CallInst(FuncPtr, &Args[0], Args.size(),
+ CallInst *Call = new CallInst(FuncPtr, Args.begin(), Args.end(),
"retval", DoCallBB);
new ReturnInst(Call, DoCallBB);
}
diff --git a/llvm/tools/llvm-upgrade/UpgradeParser.y b/llvm/tools/llvm-upgrade/UpgradeParser.y
index ed84267d08a..c9b3e6a7dc9 100644
--- a/llvm/tools/llvm-upgrade/UpgradeParser.y
+++ b/llvm/tools/llvm-upgrade/UpgradeParser.y
@@ -1513,7 +1513,7 @@ upgradeIntrinsicCall(const Type* RetTy, const ValID &ID,
const PointerType *PFTy = PointerType::get(FTy);
Value* Func = getVal(PFTy, ID);
Args[0] = new BitCastInst(Args[0], PtrTy, makeNameUnique("va"), CurBB);
- return new CallInst(Func, &Args[0], Args.size());
+ return new CallInst(Func, Args.begin(), Args.end());
} else if (Name == "llvm.va_copy") {
if (Args.size() != 2)
error("Invalid prototype for " + Name + " prototype");
@@ -1527,7 +1527,7 @@ upgradeIntrinsicCall(const Type* RetTy, const ValID &ID,
std::string InstName1(makeNameUnique("va1"));
Args[0] = new BitCastInst(Args[0], PtrTy, InstName0, CurBB);
Args[1] = new BitCastInst(Args[1], PtrTy, InstName1, CurBB);
- return new CallInst(Func, &Args[0], Args.size());
+ return new CallInst(Func, Args.begin(), Args.end());
}
}
}
@@ -1751,11 +1751,12 @@ Module* UpgradeAssembly(const std::string &infile, std::istream& in,
while (!F->use_empty()) {
CallInst* CI = cast<CallInst>(F->use_back());
- AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
- AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
- new StoreInst(CI->getOperand(1), b, CI);
- new CallInst(NF, a, b, "", CI);
- Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
+ SmallVector<Value *, 2> Args;
+ Args.push_back(new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI));
+ Args.push_back(new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI));
+ new StoreInst(CI->getOperand(1), Args[1], CI);
+ new CallInst(NF, Args.begin(), Args.end(), "", CI);
+ Value* foo = new LoadInst(Args[0], "vacopy.fix.3", CI);
CI->replaceAllUsesWith(foo);
CI->getParent()->getInstList().erase(CI);
}
@@ -3806,7 +3807,7 @@ InstVal
}
// Create the call instruction
- CallInst *CI = new CallInst(V, &Args[0], Args.size());
+ CallInst *CI = new CallInst(V, Args.begin(), Args.end());
CI->setTailCall($1);
CI->setCallingConv(upgradeCallingConv($2));
$$.I = CI;
OpenPOWER on IntegriCloud