[Mlir-commits] [mlir] [MLIR] `remove-dead-values` and RegionBranchOp canononicalizations fixes around the `IsolatedFromAbove` ops (PR #224831)
Matthias Springer
llvmlistbot at llvm.org
Sat Sep 19 20:57:09 PDT 2026
================
@@ -744,8 +742,19 @@ struct MakeRegionBranchOpSuccessorInputsDead : public RewritePattern {
/*maxReachableValues=*/1)) ||
reachableValues.empty())
continue;
- assert(*reachableValues.begin() != value &&
+ Value replacement = *reachableValues.begin();
+ assert(replacement != value &&
"successor inputs are supposed to be excluded");
+ // A value inside an isolated region cannot be replaced with a value from
+ // another region, even if the replacement dominates its uses. Op results
+ // are in the parent region and do not cross this isolation boundary.
+ // Successor inputs are direct region arguments or results of this op.
+ // Valid input IR already prevents captures across nested isolation
+ // boundaries, so only this op's boundary needs an additional check.
+ Region *valueRegion = value.getParentRegion();
----------------
matthias-springer wrote:
This looks correct, but can you also add a small IR snippet, similar to the `isDefinedBefore` check below?
https://github.com/llvm/llvm-project/pull/224831
More information about the Mlir-commits
mailing list