From 7a25bd1d1950f39935afecdebf3c59d2b3f4eae4 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Mon, 2 Mar 2020 09:23:28 -0800 Subject: [PATCH] [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 --- mlir/lib/Transforms/DialectConversion.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mlir/lib/Transforms/DialectConversion.cpp b/mlir/lib/Transforms/DialectConversion.cpp index 8e1a9cc942bd..ed81b588875c 100644 --- a/mlir/lib/Transforms/DialectConversion.cpp +++ b/mlir/lib/Transforms/DialectConversion.cpp @@ -51,9 +51,11 @@ computeConversionSet(iterator_range region, : Optional(); if (legalityInfo && legalityInfo->isRecursivelyLegal) continue; - for (auto ®ion : op.getRegions()) - computeConversionSet(region.getBlocks(), region.getLoc(), toConvert, - target); + for (auto ®ion : op.getRegions()) { + if (failed(computeConversionSet(region.getBlocks(), region.getLoc(), + toConvert, target))) + return failure(); + } } // Recurse to children that haven't been visited.