/// TestOptimizer - This is the predicate function used to check to see if the /// "Test" portion of the program is misoptimized. If so, return true. In any /// case, both module arguments are deleted. /// static bool TestOptimizer(BugDriver &BD, Module *Test, Module *Safe) { // Run the optimization passes on ToOptimize, producing a transformed version // of the functions being tested. outs() << " Optimizing functions being tested: "; Module *Optimized = BD.runPassesOn(Test, BD.getPassesToRun(), /*AutoDebugCrashes*/true); outs() << "done.\n"; delete Test; outs() << " Checking to see if the merged program executes correctly: "; bool Broken = TestMergedProgram(BD, Optimized, Safe, true); outs() << (Broken ? " nope.\n" : " yup.\n"); return Broken; }
/// TestOptimizer - This is the predicate function used to check to see if the /// "Test" portion of the program is misoptimized. If so, return true. In any /// case, both module arguments are deleted. /// static bool TestOptimizer(BugDriver &BD, Module *Test, Module *Safe, std::string &Error) { // Run the optimization passes on ToOptimize, producing a transformed version // of the functions being tested. outs() << " Optimizing functions being tested: "; Module *Optimized = BD.runPassesOn(Test, BD.getPassesToRun(), /*AutoDebugCrashes*/true); outs() << "done.\n"; delete Test; outs() << " Checking to see if the merged program executes correctly: "; bool Broken; Module *New = TestMergedProgram(BD, Optimized, Safe, true, Error, Broken); if (New) { outs() << (Broken ? " nope.\n" : " yup.\n"); // Delete the original and set the new program. delete BD.swapProgramIn(New); } return Broken; }
/// This is the predicate function used to check to see if the "Test" portion of /// the program is misoptimized. If so, return true. In any case, both module /// arguments are deleted. /// static bool TestOptimizer(BugDriver &BD, std::unique_ptr<Module> Test, std::unique_ptr<Module> Safe, std::string &Error) { // Run the optimization passes on ToOptimize, producing a transformed version // of the functions being tested. outs() << " Optimizing functions being tested: "; std::unique_ptr<Module> Optimized = BD.runPassesOn(Test.get(), BD.getPassesToRun(), /*AutoDebugCrashes*/ true); outs() << "done.\n"; outs() << " Checking to see if the merged program executes correctly: "; bool Broken; std::unique_ptr<Module> New = testMergedProgram( BD, std::move(Optimized), std::move(Safe), Error, Broken); if (New) { outs() << (Broken ? " nope.\n" : " yup.\n"); // Delete the original and set the new program. delete BD.swapProgramIn(New.release()); } return Broken; }
static bool TestForOptimizerCrash(const BugDriver &BD, Module *M) { return BD.runPasses(M, BD.getPassesToRun()); }