@@ -852,7 +852,8 @@ static bool isValuePotentiallyUsedAsPointer(Value val) {
852852 continue ;
853853 seen.insert (cur);
854854 for (Operation *user : cur.getUsers ()) {
855- if (isa<RegionBranchOpInterface>(user->getParentOp ()))
855+ if (auto regionIface =
856+ dyn_cast<RegionBranchOpInterface>(user->getParentOp ()))
856857 if (auto termIface =
857858 dyn_cast<RegionBranchTerminatorOpInterface>(user)) {
858859 SmallVector<RegionSuccessor> successors;
@@ -864,9 +865,10 @@ static bool isValuePotentiallyUsedAsPointer(Value val) {
864865 for (auto &successor : successors) {
865866 OperandRange operandRange =
866867 termIface.getSuccessorOperands (successor);
867- ValueRange targetValues = successor.isParent ()
868- ? parentOp->getResults ()
869- : successor.getSuccessorInputs ();
868+ ValueRange targetValues =
869+ successor.isParent ()
870+ ? parentOp->getResults ()
871+ : regionIface.getSuccessorInputs (successor);
870872 assert (operandRange.size () == targetValues.size ());
871873 for (auto &&[prev, post ] : llvm::zip (operandRange, targetValues)) {
872874 if (prev == cur) {
@@ -969,7 +971,8 @@ getPotentialTerminatorUsers(Operation *op, Value parent) {
969971
970972 if (auto termIface = dyn_cast<ADDataFlowOpInterface>(op->getParentOp ())) {
971973 return termIface.getPotentialTerminatorUsers (op, parent);
972- } else if (isa<RegionBranchOpInterface>(op->getParentOp ())) {
974+ } else if (auto regionIface =
975+ dyn_cast<RegionBranchOpInterface>(op->getParentOp ())) {
973976 if (auto termIface = dyn_cast<RegionBranchTerminatorOpInterface>(op)) {
974977 SmallVector<RegionSuccessor> successors;
975978 termIface.getSuccessorRegions (
@@ -980,9 +983,9 @@ getPotentialTerminatorUsers(Operation *op, Value parent) {
980983 SmallVector<Value> results;
981984 for (auto &successor : successors) {
982985 OperandRange operandRange = termIface.getSuccessorOperands (successor);
983- ValueRange targetValues = successor. isParent ()
984- ? parentOp->getResults ()
985- : successor .getSuccessorInputs ();
986+ ValueRange targetValues =
987+ successor. isParent () ? parentOp->getResults ()
988+ : regionIface .getSuccessorInputs (successor );
986989 assert (operandRange.size () == targetValues.size ());
987990 for (auto &&[prev, post ] : llvm::zip (operandRange, targetValues)) {
988991 if (prev == parent) {
@@ -1065,8 +1068,8 @@ static SmallVector<Value> getPotentialIncomingValues(OpResult res) {
10651068 block.getTerminator ())) {
10661069 // TODO: the interface may also tell us which regions are allowed to
10671070 // yield parent op results, and which only branch to other regions.
1068- auto successorOperands = llvm::to_vector (iface. getSuccessorOperands (
1069- RegionSuccessor::parent (iface-> getResults () )));
1071+ auto successorOperands = llvm::to_vector (
1072+ iface. getSuccessorOperands ( RegionSuccessor::parent ()));
10701073 // TODO: understand/document the assumption of how operands flow.
10711074
10721075 if (successorOperands.size () != owner->getNumResults ()) {
@@ -1131,7 +1134,8 @@ static SmallVector<Value> getPotentialIncomingValues(BlockArgument arg) {
11311134 continue ;
11321135
11331136 unsigned operandOffset = static_cast <unsigned >(-1 );
1134- for (const auto &en : llvm::enumerate (successor.getSuccessorInputs ())) {
1137+ for (const auto &en :
1138+ llvm::enumerate (iface.getSuccessorInputs (successor))) {
11351139 if (en.value () != arg)
11361140 continue ;
11371141 operandOffset = en.index ();
@@ -1146,7 +1150,7 @@ static SmallVector<Value> getPotentialIncomingValues(BlockArgument arg) {
11461150 // XXX: this assumes a contiguous slice of operands is mapped 1-1
11471151 // without swaps to a contiguous slice of entry block arguments.
11481152 assert (iface.getEntrySuccessorOperands (region).size () ==
1149- successor .getSuccessorInputs ().size ());
1153+ iface .getSuccessorInputs (successor ).size ());
11501154 potentialSources.insert (
11511155 iface.getEntrySuccessorOperands (region)[operandOffset]);
11521156 } else {
@@ -1162,7 +1166,7 @@ static SmallVector<Value> getPotentialIncomingValues(BlockArgument arg) {
11621166 // 1-1 without swaps to a contiguous slice of entry block
11631167 // arguments.
11641168 assert (terminator.getSuccessorOperands (region).size () ==
1165- successor .getSuccessorInputs ().size ());
1169+ iface .getSuccessorInputs (successor ).size ());
11661170 potentialSources.insert (
11671171 terminator.getSuccessorOperands (region)[operandOffset]);
11681172 } else {
0 commit comments