[Mlir-commits] [mlir] [MLIR][SliceAnalysis] Add comment and restore failure condition (PR #142223)
William Moses
llvmlistbot at llvm.org
Sat May 31 09:17:57 PDT 2025
https://github.com/wsmoses updated https://github.com/llvm/llvm-project/pull/142223
>From 90167b53edc46a32fbd3cb7dd9bf79617ffd2026 Mon Sep 17 00:00:00 2001
From: "William S. Moses" <gh at wsmoses.com>
Date: Fri, 30 May 2025 18:24:19 -0400
Subject: [PATCH 1/2] [MLIR][SliceAnalysis] Add comment and restore failure
condition
---
mlir/include/mlir/Analysis/SliceAnalysis.h | 2 ++
mlir/lib/Analysis/SliceAnalysis.cpp | 2 ++
2 files changed, 4 insertions(+)
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 {
>From 1a578c9bfeb4c295c9f690ecdecc2bd04819251c Mon Sep 17 00:00:00 2001
From: William Moses <gh at wsmoses.com>
Date: Sat, 31 May 2025 12:17:50 -0400
Subject: [PATCH 2/2] Update mlir/include/mlir/Analysis/SliceAnalysis.h
Co-authored-by: Mehdi Amini <joker.eph at gmail.com>
---
mlir/include/mlir/Analysis/SliceAnalysis.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mlir/include/mlir/Analysis/SliceAnalysis.h b/mlir/include/mlir/Analysis/SliceAnalysis.h
index dc0d56d6b753d..b6efdcee30683 100644
--- a/mlir/include/mlir/Analysis/SliceAnalysis.h
+++ b/mlir/include/mlir/Analysis/SliceAnalysis.h
@@ -141,7 +141,7 @@ 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.
+/// whose parent op has more than one region, or a region with more than one block.
LogicalResult getBackwardSlice(Operation *op,
SetVector<Operation *> *backwardSlice,
const BackwardSliceOptions &options = {});
More information about the Mlir-commits
mailing list