mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
Use RunPassesOn as in the rest of bugpoint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110682 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -55,13 +55,14 @@ namespace {
|
||||
/// depends on the value. The modified module is then returned.
|
||||
///
|
||||
Module *BugDriver::deleteInstructionFromProgram(const Instruction *I,
|
||||
unsigned Simplification) const {
|
||||
Module *Result = CloneModule(Program);
|
||||
unsigned Simplification) {
|
||||
// FIXME, use vmap?
|
||||
Module *Clone = CloneModule(Program);
|
||||
|
||||
const BasicBlock *PBB = I->getParent();
|
||||
const Function *PF = PBB->getParent();
|
||||
|
||||
Module::iterator RFI = Result->begin(); // Get iterator to corresponding fn
|
||||
Module::iterator RFI = Clone->begin(); // Get iterator to corresponding fn
|
||||
std::advance(RFI, std::distance(PF->getParent()->begin(),
|
||||
Module::const_iterator(PF)));
|
||||
|
||||
@ -79,24 +80,23 @@ Module *BugDriver::deleteInstructionFromProgram(const Instruction *I,
|
||||
// Remove the instruction from the program.
|
||||
TheInst->getParent()->getInstList().erase(TheInst);
|
||||
|
||||
|
||||
//writeProgramToFile("current.bc", Result);
|
||||
|
||||
// Spiff up the output a little bit.
|
||||
PassManager Passes;
|
||||
// Make sure that the appropriate target data is always used...
|
||||
Passes.add(new TargetData(Result));
|
||||
std::vector<std::string> Passes;
|
||||
|
||||
/// FIXME: If this used runPasses() like the methods below, we could get rid
|
||||
/// of the -disable-* options!
|
||||
/// Can we get rid of the -disable-* options?
|
||||
if (Simplification > 1 && !NoDCE)
|
||||
Passes.add(createDeadCodeEliminationPass());
|
||||
Passes.push_back("dce");
|
||||
if (Simplification && !DisableSimplifyCFG)
|
||||
Passes.add(createCFGSimplificationPass()); // Delete dead control flow
|
||||
Passes.push_back("simplifycfg"); // Delete dead control flow
|
||||
|
||||
Passes.add(createVerifierPass());
|
||||
Passes.run(*Result);
|
||||
return Result;
|
||||
Passes.push_back("verify");
|
||||
Module *New = runPassesOn(Clone, Passes);
|
||||
delete Clone;
|
||||
if (!New) {
|
||||
errs() << "Instruction removal failed. Sorry. :( Please report a bug!\n";
|
||||
exit(1);
|
||||
}
|
||||
return New;
|
||||
}
|
||||
|
||||
/// performFinalCleanups - This method clones the current Program and performs
|
||||
|
Reference in New Issue
Block a user