[Mlir-commits] [mlir] [MLIR][SliceAnalysis] Add comment and restore failure condition (PR #142223)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri May 30 15:25:10 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: William Moses (wsmoses)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/142223.diff


2 Files Affected:

- (modified) mlir/include/mlir/Analysis/SliceAnalysis.h (+2) 
- (modified) mlir/lib/Analysis/SliceAnalysis.cpp (+2) 


``````````diff
diff --git a/mlir/include/mlir/Analysis/SliceAnalysis.h b/mlir/include/mlir/Analysis/SliceAnalysis.h
index d082d2d9f758b..dc0d56d6b753d 100644
--- a/mlir/include/mlir/Analysis/SliceAnalysis.h
+++ b/mlir/include/mlir/Analysis/SliceAnalysis.h
@@ -140,6 +140,8 @@ void getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
 ///
 /// This function returns whether the backwards slice was able to be
 /// successfully computed, and failure if it was unable to determine the slice.
+/// This function will presently return failure if a value to process is a blockargument
+/// whose parent op has more than region or more than one block.
 LogicalResult getBackwardSlice(Operation *op,
                                SetVector<Operation *> *backwardSlice,
                                const BackwardSliceOptions &options = {});
diff --git a/mlir/lib/Analysis/SliceAnalysis.cpp b/mlir/lib/Analysis/SliceAnalysis.cpp
index 4cdf47a405c01..20ba558507f4e 100644
--- a/mlir/lib/Analysis/SliceAnalysis.cpp
+++ b/mlir/lib/Analysis/SliceAnalysis.cpp
@@ -109,6 +109,8 @@ static LogicalResult getBackwardSliceImpl(Operation *op,
         if (parentOp->getNumRegions() == 1 &&
             llvm::hasSingleElement(parentOp->getRegion(0).getBlocks())) {
           return getBackwardSliceImpl(parentOp, backwardSlice, options);
+        } else {
+          return failure();
         }
       }
     } else {

``````````

</details>


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


More information about the Mlir-commits mailing list