@@ -137,6 +137,13 @@ getMutableSuccessorOperands(Block *block, unsigned successorIndex) {
137
137
return succOps.getMutableForwardedOperands ();
138
138
}
139
139
140
+ // / Return the operand range used to transfer operands from `block` to its
141
+ // / successor with the given index.
142
+ static OperandRange getSuccessorOperands (Block *block,
143
+ unsigned successorIndex) {
144
+ return getMutableSuccessorOperands (block, successorIndex);
145
+ }
146
+
140
147
// / Appends all the block arguments from `other` to the block arguments of
141
148
// / `block`, copying their types and locations.
142
149
static void addBlockArgumentsFromOther (Block *block, Block *other) {
@@ -175,8 +182,14 @@ class Edge {
175
182
176
183
// / Returns the arguments of this edge that are passed to the block arguments
177
184
// / of the successor.
178
- MutableOperandRange getSuccessorOperands () const {
179
- return getMutableSuccessorOperands (fromBlock, successorIndex);
185
+ MutableOperandRange getMutableSuccessorOperands () const {
186
+ return ::getMutableSuccessorOperands (fromBlock, successorIndex);
187
+ }
188
+
189
+ // / Returns the arguments of this edge that are passed to the block arguments
190
+ // / of the successor.
191
+ OperandRange getSuccessorOperands () const {
192
+ return ::getSuccessorOperands (fromBlock, successorIndex);
180
193
}
181
194
};
182
195
@@ -262,7 +275,7 @@ class EdgeMultiplexer {
262
275
assert (result != blockArgMapping.end () &&
263
276
" Edge was not originally passed to `create` method." );
264
277
265
- MutableOperandRange successorOperands = edge.getSuccessorOperands ();
278
+ MutableOperandRange successorOperands = edge.getMutableSuccessorOperands ();
266
279
267
280
// Extra arguments are always appended at the end of the block arguments.
268
281
unsigned extraArgsBeginIndex =
@@ -666,7 +679,7 @@ transformToReduceLoop(Block *loopHeader, Block *exitBlock,
666
679
// invalidated when mutating the operands through a different
667
680
// `MutableOperandRange` of the same operation.
668
681
SmallVector<Value> loopHeaderSuccessorOperands =
669
- llvm::to_vector (getMutableSuccessorOperands (latch, loopHeaderIndex));
682
+ llvm::to_vector (getSuccessorOperands (latch, loopHeaderIndex));
670
683
671
684
// Add all values used in the next iteration to the exit block. Replace
672
685
// any uses that are outside the loop with the newly created exit block.
@@ -742,7 +755,7 @@ transformToReduceLoop(Block *loopHeader, Block *exitBlock,
742
755
743
756
loopHeaderSuccessorOperands.push_back (argument);
744
757
for (Edge edge : successorEdges (latch))
745
- edge.getSuccessorOperands ().append (argument);
758
+ edge.getMutableSuccessorOperands ().append (argument);
746
759
}
747
760
748
761
use.set (blockArgument);
@@ -939,9 +952,8 @@ static FailureOr<SmallVector<Block *>> transformToStructuredCFBranches(
939
952
if (regionEntry->getNumSuccessors () == 1 ) {
940
953
// Single successor we can just splice together.
941
954
Block *successor = regionEntry->getSuccessor (0 );
942
- for (auto &&[oldValue, newValue] :
943
- llvm::zip (successor->getArguments (),
944
- getMutableSuccessorOperands (regionEntry, 0 )))
955
+ for (auto &&[oldValue, newValue] : llvm::zip (
956
+ successor->getArguments (), getSuccessorOperands (regionEntry, 0 )))
945
957
oldValue.replaceAllUsesWith (newValue);
946
958
regionEntry->getTerminator ()->erase ();
947
959
0 commit comments