[Mlir-commits] [mlir] [MLIR] Change getBackwardSlice to return a logicalresult rather than crash (PR #140961)

Mehdi Amini llvmlistbot at llvm.org
Fri May 23 03:05:29 PDT 2025


================
@@ -138,13 +138,17 @@ void getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
 /// Assuming all local orders match the numbering order:
 ///    {1, 2, 5, 3, 4, 6}
 ///
-void getBackwardSlice(Operation *op, SetVector<Operation *> *backwardSlice,
-                      const BackwardSliceOptions &options = {});
+/// This function returns whether the backwards slice was able to be
+/// successfully computed, and failure if it was unable to determine the slice.
----------------
joker-eph wrote:

That isn't a helpful comment IMO: just seeing the LogicalResult I understand that "this can fail".

What I'd expect is describe the failure **condition** here. What is a prerequisite  of the API.

https://github.com/llvm/llvm-project/pull/140961


More information about the Mlir-commits mailing list