Lines Matching refs:BD
61 BugDriver &BD;
63 ReducePassList(BugDriver &bd) : BD(bd) {}
84 if (BD.runPasses(BD.getProgram(), Prefix, PrefixOutput))
87 OrigProgram = BD.Program;
89 BD.Program = parseInputFile(PrefixOutput, BD.getContext()).release();
90 if (BD.Program == nullptr) {
91 errs() << BD.getToolName() << ": Error reading bitcode file '"
101 if (BD.runPasses(BD.getProgram(), Suffix)) {
108 delete BD.Program;
109 BD.Program = OrigProgram;
120 BugDriver &BD;
123 ReduceCrashingGlobalVariables(BugDriver &bd,
125 : BD(bd), TestFn(testFn) {}
146 Module *M = CloneModule(BD.getProgram(), VMap).release();
170 if (TestFn(BD, M)) {
171 BD.setNewProgram(M); // It crashed, keep the trimmed version...
189 BugDriver &BD;
192 ReduceCrashingFunctions(BugDriver &bd,
194 : BD(bd), TestFn(testFn) {}
236 BD.getProgram()->getFunction("main")) ==
242 Module *M = CloneModule(BD.getProgram(), VMap).release();
305 if (TestFn(BD, M)) {
306 BD.setNewProgram(M); // It crashed, keep the trimmed version...
325 BugDriver &BD;
328 ReduceCrashingBlocks(BugDriver &bd,
330 : BD(bd), TestFn(testFn) {}
349 Module *M = CloneModule(BD.getProgram(), VMap).release();
400 std::unique_ptr<Module> New = BD.runPassesOn(M, Passes);
409 if (TestFn(BD, M)) {
410 BD.setNewProgram(M); // It crashed, keep the trimmed version...
434 BugDriver &BD;
437 ReduceCrashingInstructions(BugDriver &bd,
439 : BD(bd), TestFn(testFn) {}
459 Module *M = CloneModule(BD.getProgram(), VMap).release();
492 if (TestFn(BD, M)) {
493 BD.setNewProgram(M); // It crashed, keep the trimmed version...
510 BugDriver &BD;
514 ReduceCrashingNamedMD(BugDriver &bd,
516 : BD(bd), TestFn(testFn) {}
535 Module *M = CloneModule(BD.getProgram(), VMap).release();
567 if (TestFn(BD, M)) {
568 BD.setNewProgram(M); // It crashed, keep the trimmed version...
578 BugDriver &BD;
582 ReduceCrashingNamedMDOps(BugDriver &bd,
584 : BD(bd), TestFn(testFn) {}
615 Module *M = CloneModule(BD.getProgram(), VMap).release();
619 for (auto &NamedMD : BD.getProgram()->named_metadata()) {
635 if (TestFn(BD, M)) {
642 BD.setNewProgram(M); // It crashed, keep the trimmed version...
652 static bool DebugACrash(BugDriver &BD,
658 BD.getProgram()->global_begin() != BD.getProgram()->global_end()) {
661 Module *M = CloneModule(BD.getProgram()).release();
678 if (TestFn(BD, M)) { // Still crashes?
679 BD.setNewProgram(M);
687 for (Module::global_iterator I = BD.getProgram()->global_begin(),
688 E = BD.getProgram()->global_end(); I != E; ++I)
697 ReduceCrashingGlobalVariables(BD, TestFn).reduceList(GVs, Error);
702 BD.EmitProgressBitcode(BD.getProgram(), "reduced-global-variables");
710 for (Function &F : *BD.getProgram())
719 ReduceCrashingFunctions(BD, TestFn).reduceList(Functions, Error);
722 BD.EmitProgressBitcode(BD.getProgram(), "reduced-function");
732 for (Function &F : *BD.getProgram())
736 ReduceCrashingBlocks(BD, TestFn).reduceList(Blocks, Error);
738 BD.EmitProgressBitcode(BD.getProgram(), "reduced-blocks");
745 for (const Function &F : *BD.getProgram())
751 ReduceCrashingInstructions(BD, TestFn).reduceList(Insts, Error);
777 for (Module::const_iterator FI = BD.getProgram()->begin(),
778 E = BD.getProgram()->end(); FI != E; ++FI)
794 BD.deleteInstructionFromProgram(&*I, Simplification);
797 if (TestFn(BD, M.get())) {
800 BD.setNewProgram(M.release());
815 BD.EmitProgressBitcode(BD.getProgram(), "reduced-instructions");
822 for (auto &NamedMD : BD.getProgram()->named_metadata())
824 ReduceCrashingNamedMD(BD, TestFn).reduceList(NamedMDNames, Error);
831 for (auto &NamedMD : BD.getProgram()->named_metadata())
834 ReduceCrashingNamedMDOps(BD, TestFn).reduceList(NamedMDOps, Error);
843 Module *M = CloneModule(BD.getProgram()).release();
844 M = BD.performFinalCleanups(M, true).release();
847 if (TestFn(BD, M)) {
848 BD.setNewProgram(M); // Yup, it does, keep the reduced version...
854 BD.EmitProgressBitcode(BD.getProgram(), "reduced-simplified");
859 static bool TestForOptimizerCrash(const BugDriver &BD, Module *M) {
860 return BD.runPasses(M);
887 static bool TestForCodeGenCrash(const BugDriver &BD, Module *M) {
889 BD.compileProgram(M, &Error);