diff --git a/mlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp b/mlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp --- a/mlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp +++ b/mlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp @@ -37,7 +37,7 @@ // Replaces all tosa.yield ops with a branch to the correct target. This is // used for processing each branch of tosa.if -LogicalResult ReplaceYieldOps(Region *region, Block *targetBlock, Location loc, +LogicalResult replaceYieldOps(Region *region, Block *targetBlock, Location loc, const BlockAndValueMapping &mapper, OpBuilder *builder) { for (auto &oldBlock : region->getBlocks()) { @@ -56,7 +56,7 @@ LogicalResult legalizeTosaIf(IfOp ifOp) { Operation *operation = ifOp.getOperation(); mlir::OpBuilder builder(ifOp); - auto origBlock = operation->getBlock(); + auto *origBlock = operation->getBlock(); auto *tailBlock = origBlock->splitBlock(operation); auto loc = ifOp.getLoc(); @@ -79,10 +79,10 @@ elseBranch, ifOp.inputs()); // Yields need to be replaced with branches to the tile block. - if (failed(ReplaceYieldOps(&ifOp.then_branch(), tailBlock, loc, mapper, + if (failed(replaceYieldOps(&ifOp.then_branch(), tailBlock, loc, mapper, &builder))) return failure(); - if (failed(ReplaceYieldOps(&ifOp.else_branch(), tailBlock, loc, mapper, + if (failed(replaceYieldOps(&ifOp.else_branch(), tailBlock, loc, mapper, &builder))) return failure(); @@ -123,15 +123,15 @@ // tensor.extract and conditional branch to the body block or tail. builder.setInsertionPointToStart(condBlock); for (auto &block : whileOp.cond()) { - auto newBlock = mapper.lookup(&block); + auto *newBlock = mapper.lookup(&block); - auto returnOp = dyn_cast(newBlock->getTerminator()); - if (!returnOp) + auto yieldOp = dyn_cast(newBlock->getTerminator()); + if (!yieldOp) continue; builder.setInsertionPointToEnd(newBlock); - auto return_value = returnOp.getOperand(0); - auto condValue = builder.create(loc, return_value); + auto yieldValue = yieldOp.getOperand(0); + auto condValue = builder.create(loc, yieldValue); // Pass the args passed to the cond block as the arguments for each branch // condition. @@ -139,18 +139,18 @@ condBlock->args_end()); builder.create(loc, condValue, bodyBlock, successorArgs, tailBlock, successorArgs); - returnOp.erase(); + yieldOp.erase(); } // Replaces all yield s in the while op body with branches to the condition. for (auto &block : whileOp.body()) { - auto newBlock = mapper.lookup(&block); - auto returnOp = dyn_cast(newBlock->getTerminator()); - if (!returnOp) + auto *newBlock = mapper.lookup(&block); + auto yieldOp = dyn_cast(newBlock->getTerminator()); + if (!yieldOp) continue; builder.setInsertionPointToEnd(newBlock); - builder.create(loc, condBlock, returnOp.getOperands()); - returnOp.erase(); + builder.create(loc, condBlock, yieldOp.getOperands()); + yieldOp.erase(); } // Erase the original while loop.