[MLIR][NFC] Adopt FuncOp/Region argument API's.

- Use FuncOp::getArguments() and Region::getArguments() and friends where possible
  instead of going through the front() block.

PiperOrigin-RevId: 325352975
This commit is contained in:
Rahul Joshi 2020-08-06 18:31:33 -07:00 committed by Geoffrey Martin-Noble
parent cd22ecd136
commit a6978cf4ab
1 changed files with 3 additions and 3 deletions

View File

@ -147,9 +147,9 @@ class LhloReduceToGPULaunchConverter : public OpConversionPattern<ReduceOp> {
// Now copy over the actual body of the reduction, leaving out the // Now copy over the actual body of the reduction, leaving out the
// terminator. // terminator.
BlockAndValueMapping mapping; BlockAndValueMapping mapping;
mapping.map(reduce_op.body().front().getArgument(0), accumulator); mapping.map(reduce_op.body().getArgument(0), accumulator);
mapping.map(reduce_op.body().front().getArgument(1), rhs); mapping.map(reduce_op.body().getArgument(1), rhs);
mapping.map(reduce_op.body().front().getArgument(2), accumulator); mapping.map(reduce_op.body().getArgument(2), accumulator);
for (auto& nested : reduce_op.body().front().without_terminator()) { for (auto& nested : reduce_op.body().front().without_terminator()) {
auto clone = rewriter.clone(nested, mapping); auto clone = rewriter.clone(nested, mapping);
for (auto pair : llvm::zip(nested.getResults(), clone->getResults())) { for (auto pair : llvm::zip(nested.getResults(), clone->getResults())) {