From 6a8dde04a07287f837bbabeb93e23e47af366d3d Mon Sep 17 00:00:00 2001 From: William Moses Date: Thu, 22 May 2025 14:13:32 -0500 Subject: [MLIR] Change getBackwardSlice to return a logicalresult rather than crash (#140961) The current implementation of getBackwardSlice will crash if an operation in the dependency chain is defined by an operation with multiple regions or blocks. Crashing is bad (and forbids many analyses from using getBackwardSlice, as well as causing existing users of getBackwardSlice to fail for IR with this property). This PR instead causes the analysis to return a failure, rather than crash in the cases it cannot compute the full slice --------- Co-authored-by: Oleksandr "Alex" Zinenko --- mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp') diff --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp index 8b16da387457..0ec9ddc25ff8 100644 --- a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp +++ b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp @@ -317,7 +317,9 @@ getSliceContract(Operation *op, auto *currentOp = (slice)[currentIndex]; // Compute and insert the backwardSlice starting from currentOp. backwardSlice.clear(); - getBackwardSlice(currentOp, &backwardSlice, backwardSliceOptions); + LogicalResult result = + getBackwardSlice(currentOp, &backwardSlice, backwardSliceOptions); + assert(result.succeeded() && "expected a backward slice"); slice.insert_range(backwardSlice); // Compute and insert the forwardSlice starting from currentOp. -- cgit v1.2.3