[mlir][DialectConversion] Abort early if a subregion has a disconnected CFG.

Summary:
Make computeConversionSet bubble up errors from nested regions. Note
that this doesn't change top-level behavior - since the nested region
calls emitError, the error was visible before, just not surfaced as
quickly.

Differential Revision: https://reviews.llvm.org/D75369
This commit is contained in:
Matthias Kramm 2020-03-02 09:23:28 -08:00 committed by River Riddle
parent 806bb1e029
commit 7a25bd1d19
1 changed files with 5 additions and 3 deletions

View File

@ -51,9 +51,11 @@ computeConversionSet(iterator_range<Region::iterator> region,
: Optional<ConversionTarget::LegalOpDetails>();
if (legalityInfo && legalityInfo->isRecursivelyLegal)
continue;
for (auto &region : op.getRegions())
computeConversionSet(region.getBlocks(), region.getLoc(), toConvert,
target);
for (auto &region : op.getRegions()) {
if (failed(computeConversionSet(region.getBlocks(), region.getLoc(),
toConvert, target)))
return failure();
}
}
// Recurse to children that haven't been visited.