Lines Matching refs:BD

47     BugDriver &BD;  member in __anonbf95298b0111::ReduceMiscompilingPasses
49 ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {} in ReduceMiscompilingPasses()
70 if (BD.runPasses(BD.getProgram(), Suffix, BitcodeResult, false/*delete*/, in doTest()
74 BD.setPassesToRun(Suffix); in doTest()
75 BD.EmitProgressBitcode(BD.getProgram(), "pass-error", false); in doTest()
76 exit(BD.debugOptimizerCrash()); in doTest()
80 bool Diff = BD.diffProgram(BD.getProgram(), BitcodeResult, "", in doTest()
87 errs() << BD.getToolName() << ": I'm confused: the test fails when " in doTest()
108 if (BD.runPasses(BD.getProgram(), Prefix, BitcodeResult, false/*delete*/, in doTest()
112 BD.setPassesToRun(Prefix); in doTest()
113 BD.EmitProgressBitcode(BD.getProgram(), "pass-error", false); in doTest()
114 exit(BD.debugOptimizerCrash()); in doTest()
118 Diff = BD.diffProgram(BD.getProgram(), BitcodeResult, "", false, &Error); in doTest()
132 parseInputFile(BitcodeResult, BD.getContext()); in doTest()
134 errs() << BD.getToolName() << ": Error reading bitcode file '" in doTest()
149 BD.swapProgramIn(PrefixOutput.release())); in doTest()
150 if (BD.runPasses(BD.getProgram(), Suffix, BitcodeResult, false/*delete*/, in doTest()
154 BD.setPassesToRun(Suffix); in doTest()
155 BD.EmitProgressBitcode(BD.getProgram(), "pass-error", false); in doTest()
156 exit(BD.debugOptimizerCrash()); in doTest()
160 Diff = BD.diffProgram(BD.getProgram(), BitcodeResult, "", in doTest()
172 delete BD.swapProgramIn(OriginalInput.release()); in doTest()
178 BugDriver &BD; member in __anonbf95298b0211::ReduceMiscompilingFunctions
184 : BD(bd), TestFn(F) {} in ReduceMiscompilingFunctions()
217 static Module *TestMergedProgram(const BugDriver &BD, Module *M1, Module *M2, in TestMergedProgram() argument
230 Broken = BD.diffProgram(M1, "", "", false, &Error); in TestMergedProgram()
250 << (BD.getPassesToRun().size() == 1 ? "" : "es") << ":"; in TestFuncs()
262 Module *Clone = CloneModule(BD.getProgram(), VMap); in TestFuncs()
263 Module *Orig = BD.swapProgramIn(Clone); in TestFuncs()
273 Module *ToNotOptimize = CloneModule(BD.getProgram(), VMap); in TestFuncs()
278 bool Broken = TestFn(BD, ToOptimize, ToNotOptimize, Error); in TestFuncs()
280 delete BD.swapProgramIn(Orig); in TestFuncs()
301 static bool ExtractLoops(BugDriver &BD, in ExtractLoops() argument
311 Module *ToNotOptimize = CloneModule(BD.getProgram(), VMap); in ExtractLoops()
315 Module *ToOptimizeLoopExtracted = BD.extractLoop(ToOptimize).release(); in ExtractLoops()
331 AbstractInterpreter *AI = BD.switchToSafeInterpreter(); in ExtractLoops()
333 Module *New = TestMergedProgram(BD, ToOptimizeLoopExtracted, in ExtractLoops()
339 Module *Old = BD.swapProgramIn(New); in ExtractLoops()
345 BD.switchToInterpreter(AI); in ExtractLoops()
352 BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-tno.bc", in ExtractLoops()
354 BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-to.bc", in ExtractLoops()
356 BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-to-le.bc", in ExtractLoops()
366 BD.switchToInterpreter(AI); in ExtractLoops()
376 Failure = TestFn(BD, ToOptimizeLoopExtracted, ToNotOptimize, Error); in ExtractLoops()
407 BD.setNewProgram(ToNotOptimize); in ExtractLoops()
440 BD.setNewProgram(ToNotOptimize); in ExtractLoops()
447 BugDriver &BD; member in __anonbf95298b0311::ReduceMiscompiledBlocks
455 : BD(bd), TestFn(F), FunctionsBeingTested(Fns) {} in ReduceMiscompiledBlocks()
501 Module *Clone = CloneModule(BD.getProgram(), VMap); in TestFuncs()
502 Module *Orig = BD.swapProgramIn(Clone); in TestFuncs()
515 Module *ToNotOptimize = CloneModule(BD.getProgram(), VMap); in TestFuncs()
523 BD.extractMappedBlocksFromModule(BBsOnClone, ToOptimize)) { in TestFuncs()
527 bool Ret = TestFn(BD, New.get(), ToNotOptimize, Error); in TestFuncs()
528 delete BD.swapProgramIn(Orig); in TestFuncs()
531 delete BD.swapProgramIn(Orig); in TestFuncs()
542 static bool ExtractBlocks(BugDriver &BD, in ExtractBlocks() argument
561 bool Ret = ReduceMiscompiledBlocks(BD, TestFn, MiscompiledFunctions) in ExtractBlocks()
568 ReduceMiscompiledBlocks(BD, TestFn, in ExtractBlocks()
577 Module *ProgClone = CloneModule(BD.getProgram(), VMap); in ExtractBlocks()
582 BD.extractMappedBlocksFromModule(Blocks, ToExtract); in ExtractBlocks()
606 BD.setNewProgram(ProgClone); in ExtractBlocks()
625 DebugAMiscompilation(BugDriver &BD, in DebugAMiscompilation() argument
634 Module *Prog = BD.getProgram(); in DebugAMiscompilation()
641 ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions, in DebugAMiscompilation()
657 bool Ret = ExtractLoops(BD, TestFn, MiscompiledFunctions, Error); in DebugAMiscompilation()
663 DisambiguateGlobalSymbols(BD.getProgram()); in DebugAMiscompilation()
667 ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions, in DebugAMiscompilation()
681 bool Ret = ExtractBlocks(BD, TestFn, MiscompiledFunctions, Error); in DebugAMiscompilation()
687 DisambiguateGlobalSymbols(BD.getProgram()); in DebugAMiscompilation()
690 ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions, in DebugAMiscompilation()
710 static bool TestOptimizer(BugDriver &BD, Module *Test, Module *Safe, in TestOptimizer() argument
715 std::unique_ptr<Module> Optimized = BD.runPassesOn(Test, BD.getPassesToRun(), in TestOptimizer()
723 TestMergedProgram(BD, Optimized.get(), Safe, true, Error, Broken); in TestOptimizer()
727 delete BD.swapProgramIn(New); in TestOptimizer()
779 static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, in CleanupAndPrepareModules() argument
782 Test = BD.performFinalCleanups(Test).release(); in CleanupAndPrepareModules()
785 if (!BD.isExecutingJIT()) return; in CleanupAndPrepareModules()
945 static bool TestCodeGenerator(BugDriver &BD, Module *Test, Module *Safe, in TestCodeGenerator() argument
947 CleanupAndPrepareModules(BD, Test, Safe); in TestCodeGenerator()
954 errs() << BD.getToolName() << "Error making unique filename: " in TestCodeGenerator()
958 if (BD.writeProgramToFile(TestModuleBC.str(), TestModuleFD, Test)) { in TestCodeGenerator()
973 errs() << BD.getToolName() << "Error making unique filename: " in TestCodeGenerator()
978 if (BD.writeProgramToFile(SafeModuleBC.str(), SafeModuleFD, Safe)) { in TestCodeGenerator()
986 std::string SharedObject = BD.compileSharedObject(SafeModuleBC.str(), Error); in TestCodeGenerator()
995 bool Result = BD.diffProgram(BD.getProgram(), TestModuleBC.str(), in TestCodeGenerator()