Lines Matching refs:BD
47 BugDriver &BD;
49 ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {}
70 if (BD.runPasses(BD.getProgram(), Suffix, BitcodeResult, false/*delete*/,
74 BD.setPassesToRun(Suffix);
75 BD.EmitProgressBitcode(BD.getProgram(), "pass-error", false);
76 exit(BD.debugOptimizerCrash());
80 bool Diff = BD.diffProgram(BD.getProgram(), BitcodeResult, "",
87 errs() << BD.getToolName() << ": I'm confused: the test fails when "
108 if (BD.runPasses(BD.getProgram(), Prefix, BitcodeResult, false/*delete*/,
112 BD.setPassesToRun(Prefix);
113 BD.EmitProgressBitcode(BD.getProgram(), "pass-error", false);
114 exit(BD.debugOptimizerCrash());
118 Diff = BD.diffProgram(BD.getProgram(), BitcodeResult, "", false, &Error);
132 parseInputFile(BitcodeResult, BD.getContext());
134 errs() << BD.getToolName() << ": Error reading bitcode file '"
149 BD.swapProgramIn(PrefixOutput.release()));
150 if (BD.runPasses(BD.getProgram(), Suffix, BitcodeResult, false/*delete*/,
154 BD.setPassesToRun(Suffix);
155 BD.EmitProgressBitcode(BD.getProgram(), "pass-error", false);
156 exit(BD.debugOptimizerCrash());
160 Diff = BD.diffProgram(BD.getProgram(), BitcodeResult, "",
172 delete BD.swapProgramIn(OriginalInput.release());
178 BugDriver &BD;
183 ReduceMiscompilingFunctions(BugDriver &bd,
187 : BD(bd), TestFn(F) {}
219 static std::unique_ptr<Module> testMergedProgram(const BugDriver &BD,
228 Broken = BD.diffProgram(M1.get(), "", "", false, &Error);
245 << (BD.getPassesToRun().size() == 1 ? "" : "es") << ":";
257 Module *Clone = CloneModule(BD.getProgram(), VMap).release();
258 Module *Orig = BD.swapProgramIn(Clone);
268 std::unique_ptr<Module> ToNotOptimize = CloneModule(BD.getProgram(), VMap);
273 TestFn(BD, std::move(ToOptimize), std::move(ToNotOptimize), Error);
275 delete BD.swapProgramIn(Orig);
296 static bool ExtractLoops(BugDriver &BD,
306 std::unique_ptr<Module> ToNotOptimize = CloneModule(BD.getProgram(), VMap);
311 BD.extractLoop(ToOptimize);
326 AbstractInterpreter *AI = BD.switchToSafeInterpreter();
329 testMergedProgram(BD, std::move(ToOptimizeLoopExtracted),
335 Module *Old = BD.swapProgramIn(New.release());
341 BD.switchToInterpreter(AI);
348 BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-tno.bc",
350 BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-to.bc",
352 BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-to-le.bc",
361 BD.switchToInterpreter(AI);
372 Failure = TestFn(BD, std::move(ToOptimizeLoopExtracted),
402 BD.setNewProgram(ToNotOptimize.release());
432 BD.setNewProgram(ToNotOptimize.release());
439 BugDriver &BD;
444 ReduceMiscompiledBlocks(BugDriver &bd,
448 : BD(bd), TestFn(F), FunctionsBeingTested(Fns) {}
494 Module *Clone = CloneModule(BD.getProgram(), VMap).release();
495 Module *Orig = BD.swapProgramIn(Clone);
508 std::unique_ptr<Module> ToNotOptimize = CloneModule(BD.getProgram(), VMap);
515 BD.extractMappedBlocksFromModule(BBsOnClone, ToOptimize.get())) {
516 bool Ret = TestFn(BD, std::move(New), std::move(ToNotOptimize), Error);
517 delete BD.swapProgramIn(Orig);
520 delete BD.swapProgramIn(Orig);
527 static bool ExtractBlocks(BugDriver &BD,
546 bool Ret = ReduceMiscompiledBlocks(BD, TestFn, MiscompiledFunctions)
553 ReduceMiscompiledBlocks(BD, TestFn,
562 Module *ProgClone = CloneModule(BD.getProgram(), VMap).release();
567 BD.extractMappedBlocksFromModule(Blocks, ToExtract);
590 BD.setNewProgram(ProgClone);
608 DebugAMiscompilation(BugDriver &BD,
617 Module *Prog = BD.getProgram();
624 ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions,
640 bool Ret = ExtractLoops(BD, TestFn, MiscompiledFunctions, Error);
646 DisambiguateGlobalSymbols(BD.getProgram());
650 ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions,
664 bool Ret = ExtractBlocks(BD, TestFn, MiscompiledFunctions, Error);
670 DisambiguateGlobalSymbols(BD.getProgram());
673 ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions,
693 static bool TestOptimizer(BugDriver &BD, std::unique_ptr<Module> Test,
699 BD.runPassesOn(Test.get(), BD.getPassesToRun(),
706 BD, std::move(Optimized), std::move(Safe), Error, Broken);
710 delete BD.swapProgramIn(New.release());
761 static void CleanupAndPrepareModules(BugDriver &BD,
765 Test = BD.performFinalCleanups(Test.get());
768 if (!BD.isExecutingJIT()) return;
925 static bool TestCodeGenerator(BugDriver &BD, std::unique_ptr<Module> Test,
928 CleanupAndPrepareModules(BD, Test, Safe.get());
935 errs() << BD.getToolName() << "Error making unique filename: "
939 if (BD.writeProgramToFile(TestModuleBC.str(), TestModuleFD, Test.get())) {
953 errs() << BD.getToolName() << "Error making unique filename: "
958 if (BD.writeProgramToFile(SafeModuleBC.str(), SafeModuleFD, Safe.get())) {
966 std::string SharedObject = BD.compileSharedObject(SafeModuleBC.str(), Error);
974 bool Result = BD.diffProgram(BD.getProgram(), TestModuleBC.str(),