19 #include "llvm/Support/ToolOutputFile.h"
24 : testScript(scriptName), testScriptArgs(scriptArgs) {}
26 std::pair<Tester::Interestingness, size_t>
31 if (failed(
verify(module)))
39 llvm::sys::fs::createTemporaryFile(
"mlir-reduce",
"mlir", fd, filepath);
42 llvm::report_fatal_error(llvm::Twine(
"Error making unique filename: ") +
45 llvm::ToolOutputFile out(filepath, fd);
46 module.print(out.os());
49 if (out.os().has_error())
50 llvm::report_fatal_error(llvm::Twine(
"Error emitting the IR to file '") +
53 size_t size = out.os().tell();
61 std::vector<StringRef> testerArgs;
62 testerArgs.push_back(testCase);
64 for (
const std::string &arg : testScriptArgs)
65 testerArgs.emplace_back(arg);
67 testerArgs.push_back(testCase);
70 int result = llvm::sys::ExecuteAndWait(
71 testScript, testerArgs, std::nullopt, std::nullopt,
75 llvm::report_fatal_error(
76 llvm::Twine(
"Error running interestingness test: ") + errMsg,
false);
Tester(StringRef testScript, ArrayRef< std::string > testScriptArgs)
std::pair< Interestingness, size_t > isInteresting(ModuleOp module) const
Runs the interestingness testing script on a MLIR test case file.
Include the generated interface declarations.
LogicalResult verify(Operation *op, bool verifyRecursively=true)
Perform (potentially expensive) checks of invariants, used to detect compiler bugs,...