diff options
author | dim <dim@FreeBSD.org> | 2011-07-17 15:36:56 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-07-17 15:36:56 +0000 |
commit | 1176aa52646fe641a4243a246aa7f960c708a274 (patch) | |
tree | c8086addb211fa670a9d2b1038d8c2e453229755 /tools/bugpoint | |
parent | ece02cd5829cea836e9365b0845a8ef042d17b0a (diff) | |
download | FreeBSD-src-1176aa52646fe641a4243a246aa7f960c708a274.zip FreeBSD-src-1176aa52646fe641a4243a246aa7f960c708a274.tar.gz |
Vendor import of llvm trunk r135360:
http://llvm.org/svn/llvm-project/llvm/trunk@135360
Diffstat (limited to 'tools/bugpoint')
-rw-r--r-- | tools/bugpoint/ExtractFunction.cpp | 17 | ||||
-rw-r--r-- | tools/bugpoint/Miscompilation.cpp | 10 |
2 files changed, 13 insertions, 14 deletions
diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index 593765c..9941add 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -116,8 +116,6 @@ Module *BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) { else CleanupPasses.push_back("deadargelim"); - CleanupPasses.push_back("deadtypeelim"); - Module *New = runPassesOn(M, CleanupPasses); if (New == 0) { errs() << "Final cleanups failed. Sorry. :( Please report a bug!\n"; @@ -175,13 +173,16 @@ void llvm::DeleteFunctionBody(Function *F) { static Constant *GetTorInit(std::vector<std::pair<Function*, int> > &TorList) { assert(!TorList.empty() && "Don't create empty tor list!"); std::vector<Constant*> ArrayElts; + Type *Int32Ty = Type::getInt32Ty(TorList[0].first->getContext()); + + const StructType *STy = + StructType::get(Int32Ty, TorList[0].first->getType(), NULL); for (unsigned i = 0, e = TorList.size(); i != e; ++i) { - std::vector<Constant*> Elts; - Elts.push_back(ConstantInt::get( - Type::getInt32Ty(TorList[i].first->getContext()), TorList[i].second)); - Elts.push_back(TorList[i].first); - ArrayElts.push_back(ConstantStruct::get(TorList[i].first->getContext(), - Elts, false)); + Constant *Elts[] = { + ConstantInt::get(Int32Ty, TorList[i].second), + TorList[i].first + }; + ArrayElts.push_back(ConstantStruct::get(STy, Elts)); } return ConstantArray::get(ArrayType::get(ArrayElts[0]->getType(), ArrayElts.size()), diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index 1834fe1..d645dfb 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -794,8 +794,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // Call the old main function and return its result BasicBlock *BB = BasicBlock::Create(Safe->getContext(), "entry", newMain); - CallInst *call = CallInst::Create(oldMainProto, args.begin(), args.end(), - "", BB); + CallInst *call = CallInst::Create(oldMainProto, args, "", BB); // If the type of old function wasn't void, return value of call ReturnInst::Create(Safe->getContext(), call, BB); @@ -873,8 +872,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // // call resolver(GetElementPtr...) CallInst *Resolver = - CallInst::Create(resolverFunc, ResolverArgs.begin(), - ResolverArgs.end(), "resolver", LookupBB); + CallInst::Create(resolverFunc, ResolverArgs, "resolver", LookupBB); // Cast the result from the resolver to correctly-typed function. CastInst *CastedResolver = @@ -899,10 +897,10 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // Pass on the arguments to the real function, return its result if (F->getReturnType()->isVoidTy()) { - CallInst::Create(FuncPtr, Args.begin(), Args.end(), "", DoCallBB); + CallInst::Create(FuncPtr, Args, "", DoCallBB); ReturnInst::Create(F->getContext(), DoCallBB); } else { - CallInst *Call = CallInst::Create(FuncPtr, Args.begin(), Args.end(), + CallInst *Call = CallInst::Create(FuncPtr, Args, "retval", DoCallBB); ReturnInst::Create(F->getContext(),Call, DoCallBB); } |