[llvm-branch-commits] [mlir] [mlir][SCF] Remove `RegionBranchOpInterface` from `scf.forall` (PR #174221)

Matthias Springer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 9 04:11:31 PST 2026


https://github.com/matthias-springer updated https://github.com/llvm/llvm-project/pull/174221

>From f14c7c1fd610bf08d9ded3d5af44cff0e9856ac5 Mon Sep 17 00:00:00 2001
From: Matthias Springer <me at m-sp.org>
Date: Fri, 2 Jan 2026 15:59:49 +0000
Subject: [PATCH] [mlir][SCF] Remove `RegionBranchOpInterface` from
 `scf.forall`

---
 mlir/include/mlir/Dialect/SCF/IR/SCFOps.td       |  1 -
 mlir/lib/Dialect/SCF/IR/SCF.cpp                  | 16 ----------------
 .../DataFlow/test-liveness-analysis.mlir         |  2 +-
 3 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
index 8bdf3e0b566ef..8c6c5e56e3645 100644
--- a/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
+++ b/mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
@@ -326,7 +326,6 @@ def ForallOp : SCF_Op<"forall", [
            "promoteIfSingleIteration", "yieldTiledValuesAndReplace"]>,
        RecursiveMemoryEffects,
        SingleBlockImplicitTerminator<"scf::InParallelOp">,
-       DeclareOpInterfaceMethods<RegionBranchOpInterface>,
        DestinationStyleOpInterface,
        HasParallelRegion
      ]> {
diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index a25b369d540ac..e2d758b3a900e 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -2013,22 +2013,6 @@ void ForallOp::getCanonicalizationPatterns(RewritePatternSet &results,
               ForallOpReplaceConstantInductionVar>(context);
 }
 
-/// Given the region at `index`, or the parent operation if `index` is None,
-/// return the successor regions. These are the regions that may be selected
-/// during the flow of control. `operands` is a set of optional attributes that
-/// correspond to a constant value for each operand, or null if that operand is
-/// not a constant.
-void ForallOp::getSuccessorRegions(RegionBranchPoint point,
-                                   SmallVectorImpl<RegionSuccessor> &regions) {
-  // In accordance with the semantics of forall, its body is executed in
-  // parallel by multiple threads. We should not expect to branch back into
-  // the forall body after the region's execution is complete.
-  if (point.isParent())
-    regions.push_back(RegionSuccessor(&getRegion(), getRegionIterArgs()));
-  else
-    regions.push_back(RegionSuccessor::parent(getResults()));
-}
-
 //===----------------------------------------------------------------------===//
 // InParallelOp
 //===----------------------------------------------------------------------===//
diff --git a/mlir/test/Analysis/DataFlow/test-liveness-analysis.mlir b/mlir/test/Analysis/DataFlow/test-liveness-analysis.mlir
index a3cd10f785b1d..92601a4c85223 100644
--- a/mlir/test/Analysis/DataFlow/test-liveness-analysis.mlir
+++ b/mlir/test/Analysis/DataFlow/test-liveness-analysis.mlir
@@ -346,7 +346,7 @@ func.func @affine_loop_no_use_iv() {
 // CHECK-LABEL: test_tag: forall:
 // CHECK-NEXT: operand #0: live
 // CHECK-NEXT: region: #0:
-// CHECK-NEXT:   argument: #0: live
+// CHECK-NEXT:   argument: #0: not live
 
 func.func @forall_no_use_iv_has_side_effect_op(%idx1: index, %idx2: index) {
   scf.parallel (%i) = (%idx1) to (%idx2) step (%idx2) {



More information about the llvm-branch-commits mailing list