[Mlir-commits] [mlir] [MLIR][Analysis] Fix incorrect RegionBranchOpInterface API usage in SliceWalk (PR #188758)

Mehdi Amini llvmlistbot at llvm.org
Wed Apr 1 03:20:23 PDT 2026


================
@@ -1313,6 +1313,37 @@ LoopBlockTerminatorOp::getMutableSuccessorOperands(RegionSuccessor successor) {
   return getNextIterArgMutable();
 }
 
+//===----------------------------------------------------------------------===//
+// LoopWithExtraResultOp / LoopWithExtraResultYieldOp
+//===----------------------------------------------------------------------===//
+
+void LoopWithExtraResultOp::getSuccessorRegions(
+    RegionBranchPoint point, SmallVectorImpl<RegionSuccessor> &regions) {
+  // Parent always enters the body; the body can loop back or exit to parent.
+  regions.emplace_back(&getBody());
+  if (!point.isParent())
+    regions.push_back(RegionSuccessor::parent());
+}
+
+ValueRange
+LoopWithExtraResultOp::getSuccessorInputs(RegionSuccessor successor) {
+  if (successor.isParent())
+    // Only iterResult (result #1) is a successor input; extraResult (#0) is
----------------
joker-eph wrote:

I think the comment isn't unnecessary, this is the kind of things that can be tricky. In particular in the test dialect these ops are "example". That said I would rather see one comment for the whole body instead of splitting into two parts (I refactored it).

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


More information about the Mlir-commits mailing list