[NFC] Fix formatting, comments, and a spelling
- Also move the implementation in while_loop_outline.cc into an anonymous namespace
RELNOTES:n/a
PiperOrigin-RevId: 315530618
Change-Id: I4cc67b73d3556407a828a95035ead03dcda71e23
diff --git a/tensorflow/compiler/mlir/lite/transforms/while_loop_outline.cc b/tensorflow/compiler/mlir/lite/transforms/while_loop_outline.cc
index 707f4ab..106b0f9 100644
--- a/tensorflow/compiler/mlir/lite/transforms/while_loop_outline.cc
+++ b/tensorflow/compiler/mlir/lite/transforms/while_loop_outline.cc
@@ -54,7 +54,6 @@
tensorflow::OpOrArgLocNameMapper mapper_;
};
-} // namespace
std::string WhileOutlinePass::GetName(Operation* op, StringRef suffix) {
return (mapper_.GetUniqueName(op) + suffix).str();
@@ -62,7 +61,7 @@
// Returns whether the WhileOp is already outlined (e.g., only consists of calls
// to functions).
-static bool IsAlreadyOutlinedd(WhileOp while_op) {
+bool IsAlreadyOutlined(WhileOp while_op) {
auto just_call = [](Region& region) {
auto it = region.front().begin();
if (!isa<CallOp>(*it)) return false;
@@ -120,7 +119,7 @@
}
// Skip if already just calls.
- if (extra_operands.empty() && IsAlreadyOutlinedd(while_op)) return;
+ if (extra_operands.empty() && IsAlreadyOutlined(while_op)) return;
// Collect new types.
SmallVector<Type, 4> types;
@@ -238,6 +237,7 @@
getOperation().walk(
[&](mlir::TFL::WhileOp while_op) { OutlineWhile(while_op); });
}
+} // namespace
// Creates an instance of the TensorFlow Lite dialect WhileOp outline pass.
std::unique_ptr<OperationPass<ModuleOp>> CreateWhileOutlinePass() {
diff --git a/tensorflow/compiler/mlir/tensorflow/transforms/functional_control_flow_to_cfg.cc b/tensorflow/compiler/mlir/tensorflow/transforms/functional_control_flow_to_cfg.cc
index 91bbac2..a0be88c 100644
--- a/tensorflow/compiler/mlir/tensorflow/transforms/functional_control_flow_to_cfg.cc
+++ b/tensorflow/compiler/mlir/tensorflow/transforms/functional_control_flow_to_cfg.cc
@@ -14,7 +14,7 @@
==============================================================================*/
// This transformation pass transforms functional control flow operations in the
-// standard TensorFlow dialect to MLIR Control Flow Graph (CFG) form.
+// TensorFlow dialect to MLIR Control Flow Graph (CFG) form.
#include "mlir/Dialect/StandardOps/IR/Ops.h" // from @llvm-project
#include "mlir/IR/Attributes.h" // from @llvm-project
@@ -52,7 +52,6 @@
//
// Requires the function to provide arguments for each of the `fn` operands
// that is compatible for tensor cast.
-//
static Operation* CallFn(Location loc, const std::function<Value(int)>& get_arg,
FuncOp fn, OpBuilder* builder) {
FunctionType fn_type = fn.getType();
@@ -113,7 +112,6 @@
// Requires that the block has same number of arguments as number of results of
// the operation and either they have same types or are more generic types and
// it is possible to cast them to results' types.
-//
static void ReplaceOpResultWithBlockArgs(Location loc, Operation* op,
Block* block, OpBuilder* builder) {
assert(op->getNumResults() == block->getNumArguments());
@@ -132,9 +130,6 @@
// Given a functional IfOp, transforms the enclosing code to eliminate it
// completely from the IR, breaking it into operations to evaluate the condition
// as a bool, plus some branches.
-//
-// This returns true on failure.
-//
static LogicalResult LowerIfOp(IfOp op) {
Operation* op_inst = op.getOperation();
Location loc = op_inst->getLoc();
@@ -193,9 +188,6 @@
// Given a functional WhileOp, transforms the enclosing code to eliminate it
// completely from the IR, breaking it into operations to execute the loop body
// repeatedly while the loop condition is true.
-//
-// This returns true on failure.
-//
static LogicalResult LowerWhileOp(WhileOp op) {
Operation* op_inst = op.getOperation();
Location loc = op_inst->getLoc();