@@ -423,12 +423,17 @@ void PrimLoopOp::getSuccessorRegions(
423423 RegionBranchPoint point, SmallVectorImpl<RegionSuccessor> ®ions) {
424424 Region ®ion = getRegion ();
425425 if (!point.getTerminatorPredecessorOrNull ()) {
426- regions.emplace_back (®ion, region. getArguments (). slice ( 1 ) );
426+ regions.emplace_back (®ion);
427427 return ;
428428 }
429429 assert (point.getTerminatorPredecessorOrNull ()->getParentRegion () == ®ion);
430- regions.emplace_back (®ion, region.getArguments ().slice (1 ));
431- regions.emplace_back (getOperation (), getResults ());
430+ regions.emplace_back (®ion);
431+ regions.emplace_back (RegionSuccessor::parent ());
432+ }
433+
434+ ValueRange PrimLoopOp::getSuccessorInputs (RegionSuccessor successor) {
435+ return successor.isParent () ? ValueRange (getResults ())
436+ : ValueRange (getRegion ().getArguments ().slice (1 ));
432437}
433438
434439bool PrimLoopOp::isForLike () {
@@ -494,7 +499,7 @@ void PrimIfOp::getSuccessorRegions(RegionBranchPoint point,
494499 SmallVectorImpl<RegionSuccessor> ®ions) {
495500 // The `then` and the `else` region branch back to the parent operation.
496501 if (point.getTerminatorPredecessorOrNull ()) {
497- regions.push_back (RegionSuccessor ( getOperation (), getResults () ));
502+ regions.push_back (RegionSuccessor::parent ( ));
498503 return ;
499504 }
500505
@@ -512,6 +517,10 @@ void PrimIfOp::getSuccessorRegions(RegionBranchPoint point,
512517 return ;
513518}
514519
520+ ValueRange PrimIfOp::getSuccessorInputs (RegionSuccessor successor) {
521+ return successor.isParent () ? ValueRange (getResults ()) : ValueRange ();
522+ }
523+
515524// / Replaces the given op with the contents of the given single-block region,
516525// / using the operands of the block terminator to replace operation results.
517526static void replaceOpWithRegion (PatternRewriter &rewriter, Operation *op,
@@ -5376,7 +5385,7 @@ getSuccessorRegionsForCalculateOp(CalculateOp op, RegionBranchPoint point,
53765385 Region *region = point.getTerminatorPredecessorOrNull ()->getParentRegion ();
53775386 if (region == &op.getBody ()) {
53785387 // Body returns control to the outer op, passing through results.
5379- regions.emplace_back (op. getOperation (), op. getResults ());
5388+ regions.emplace_back (RegionSuccessor::parent ());
53805389 return ;
53815390 }
53825391 assert (region == &op.getCalculation ());
@@ -5389,6 +5398,10 @@ void ShapeCalculateOp::getSuccessorRegions(
53895398 getSuccessorRegionsForCalculateOp (*this , point, regions);
53905399}
53915400
5401+ ValueRange ShapeCalculateOp::getSuccessorInputs (RegionSuccessor successor) {
5402+ return successor.isParent () ? ValueRange (getResults ()) : ValueRange ();
5403+ }
5404+
53925405// ===----------------------------------------------------------------------===//
53935406// DtypeCalculateOp
53945407// ===----------------------------------------------------------------------===//
@@ -5398,6 +5411,10 @@ void DtypeCalculateOp::getSuccessorRegions(
53985411 getSuccessorRegionsForCalculateOp (*this , point, regions);
53995412}
54005413
5414+ ValueRange DtypeCalculateOp::getSuccessorInputs (RegionSuccessor successor) {
5415+ return successor.isParent () ? ValueRange (getResults ()) : ValueRange ();
5416+ }
5417+
54015418// ===----------------------------------------------------------------------===//
54025419// ShapeCalculateYieldShapesOp
54035420// ===----------------------------------------------------------------------===//
0 commit comments