forked from OSchip/llvm-project
[mlir] run the verifier before translating a module
In translation from MLIR to another IR, run the MLIR verifier on the parsed module to ensure only valid modules are given to the translation. Previously, we would send any module that could be parsed to the translation, including semantically invalid modules, leading to surprising errors or lack thereof down the pipeline. Depends On D106937 Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D106938
This commit is contained in:
parent
c1f719d1a7
commit
49f745f59c
|
@ -102,7 +102,7 @@ TranslateFromMLIRRegistration::TranslateFromMLIRRegistration(
|
||||||
dialectRegistration(registry);
|
dialectRegistration(registry);
|
||||||
context->appendDialectRegistry(registry);
|
context->appendDialectRegistry(registry);
|
||||||
auto module = OwningModuleRef(parseSourceFile(sourceMgr, context));
|
auto module = OwningModuleRef(parseSourceFile(sourceMgr, context));
|
||||||
if (!module)
|
if (!module || failed(verify(*module)))
|
||||||
return failure();
|
return failure();
|
||||||
return function(module.get(), output);
|
return function(module.get(), output);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue