tensorflow/compiler/mlir/xla/transforms/legalize_tf_communication.cc
// Rewrites an `mhlo.while` op or its region. If `region_idx` is not set, the op
// operands and results are rewritten. If `region_idx` is set, region
// `region_idx` is rewritten to take in and return an additional token. Returns
// true if the op or its region was rewritten.
Rewrites an `mhlo.while` op or its region. If `region_idx` is not set, the op
operands and results are rewritten. If `region_idx` is set, region
`region_idx` is rewritten to take in and return an additional token. Returns
true if the op or its region was rewritten.
Rewrites an ` mhlo . while ` op or its region . If ` region_idx ` is not set the op operands and results are rewritten . If ` region_idx ` is set region ` region_idx ` is rewritten to take in and return an additional token . Returns true if the op or its region was rewritten .
bool ProcessRegionWhileOp(
    OpBuilder& builder, WhileOp region_while, Optional<unsigned> region_idx,
    SmallVectorImpl<OpVisitorState>& ops_to_visit,
    const llvm::SmallPtrSetImpl<Block*>& control_flow_blocks, Value token) {
  builder.setInsertionPoint(region_while);
  if (!region_idx) {
    RewriteRegionWhileOp(builder, region_while, ops_to_visit, token);
    return true;
  }
  if (*region_idx < region_while.getNumRegions()) {
    SmallVector<Type> arg_types;
    for (auto arg : region_while.arg()) arg_types.push_back(arg.getType());
    RewriteControlFlowOpRegion(builder, region_while, *region_idx, arg_types,
                               ops_to_visit, control_flow_blocks, token);
    return true;
  }
  return false;
}
bool ProcessRegionWhileOp ( OpBuilder & builder , WhileOp region_while , Optional < unsigned > region_idx , SmallVectorImpl < OpVisitorState > & ops_to_visit , const llvm :: SmallPtrSetImpl < Block * > & control_flow_blocks , Value token ) { builder . setInsertionPoint ( region_while ) ; if ( ! region_idx ) { RewriteRegionWhileOp ( builder , region_while , ops_to_visit , token ) ; return true ; } if ( * region_idx < region_while . getNumRegions ( ) ) { SmallVector < Type > arg_types ; for ( auto arg : region_while . arg ( ) ) arg_types . push_back ( arg . getType ( ) ) ; RewriteControlFlowOpRegion ( builder , region_while , * region_idx , arg_types , ops_to_visit , control_flow_blocks , token ) ; return true ; } return false ; }
Rewrites an `mhlo.while` op or its region.
Rewrites an ` mhlo . while ` op or its region .