forked from OSchip/llvm-project
Verify IR produced by TranslateToMLIR functions
TESTED with existing unit tests PiperOrigin-RevId: 235623059
This commit is contained in:
parent
b269481106
commit
fd3c2d156f
|
@ -59,6 +59,8 @@ static Module *parseMLIRInput(StringRef inputFilename, MLIRContext *context) {
|
|||
|
||||
static bool printMLIROutput(const Module &module,
|
||||
llvm::StringRef outputFilename) {
|
||||
if (module.verify())
|
||||
return true;
|
||||
auto file = openOutputFile(outputFilename);
|
||||
if (!file)
|
||||
return true;
|
||||
|
@ -88,8 +90,7 @@ struct TranslationParser : public llvm::cl::parser<const TranslateFunction *> {
|
|||
std::unique_ptr<Module> module = function(inputFilename, context);
|
||||
if (!module)
|
||||
return true;
|
||||
printMLIROutput(*module, outputFilename);
|
||||
return false;
|
||||
return printMLIROutput(*module, outputFilename);
|
||||
};
|
||||
wrapperStorage.emplace_back(std::move(wrapper));
|
||||
|
||||
|
|
Loading…
Reference in New Issue