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,
|
static bool printMLIROutput(const Module &module,
|
||||||
llvm::StringRef outputFilename) {
|
llvm::StringRef outputFilename) {
|
||||||
|
if (module.verify())
|
||||||
|
return true;
|
||||||
auto file = openOutputFile(outputFilename);
|
auto file = openOutputFile(outputFilename);
|
||||||
if (!file)
|
if (!file)
|
||||||
return true;
|
return true;
|
||||||
|
@ -88,8 +90,7 @@ struct TranslationParser : public llvm::cl::parser<const TranslateFunction *> {
|
||||||
std::unique_ptr<Module> module = function(inputFilename, context);
|
std::unique_ptr<Module> module = function(inputFilename, context);
|
||||||
if (!module)
|
if (!module)
|
||||||
return true;
|
return true;
|
||||||
printMLIROutput(*module, outputFilename);
|
return printMLIROutput(*module, outputFilename);
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
wrapperStorage.emplace_back(std::move(wrapper));
|
wrapperStorage.emplace_back(std::move(wrapper));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue