tensorflow/compiler/mlir/xla/transforms/legalize_tf_communication.cc
// Replaces control flow op block arguments with new block arguments
// of types `types`. The last element of the new block argument (token) is
// returned.
Replaces control flow op block arguments with new block arguments
of types `types`. The last element of the new block argument (token) is
returned.
Replaces control flow op block arguments with new block arguments of types ` types ` . The last element of the new block argument ( token ) is returned .
Value UpdateControlFlowBlockArgWithToken(OpBuilder& builder, Block& block,
                                         ArrayRef<Type> types) {
  builder.setInsertionPointToStart(&block);
  auto old_args_size = block.getNumArguments();
  block.addArguments(
      types, SmallVector<Location>(types.size(), block.getParent()->getLoc()));
  auto old_args = ArrayRef<Value>(block.getArguments().begin(),
                                  block.getArguments().begin() + old_args_size);
  auto new_args = ArrayRef<Value>(block.getArguments().begin() + old_args_size,
                                  block.getArguments().end());
  assert(!new_args.empty());
  ReplaceWithTupleResult(builder, old_args, new_args, true);
  auto new_arg = new_args[new_args.size() - 1];
  block.eraseArguments(
      llvm::to_vector(llvm::seq((unsigned)0, (unsigned)old_args_size)));
  return new_arg;
}
Value UpdateControlFlowBlockArgWithToken ( OpBuilder & builder , Block & block , ArrayRef < Type > types ) { builder . setInsertionPointToStart ( & block ) ; auto old_args_size = block . getNumArguments ( ) ; block . addArguments ( types , SmallVector < Location > ( types . size ( ) , block . getParent ( ) -> getLoc ( ) ) ) ; auto old_args = ArrayRef < Value > ( block . getArguments ( ) . begin ( ) , block . getArguments ( ) . begin ( ) + old_args_size ) ; auto new_args = ArrayRef < Value > ( block . getArguments ( ) . begin ( ) + old_args_size , block . getArguments ( ) . end ( ) ) ; assert ( ! new_args . empty ( ) ) ; ReplaceWithTupleResult ( builder , old_args , new_args , true ) ; auto new_arg = new_args [ new_args . size ( ) - 1 ] ; block . eraseArguments ( llvm :: to_vector ( llvm :: seq ( ( unsigned ) 0 , ( unsigned ) old_args_size ) ) ) ; return new_arg ; }
Replaces control flow op block arguments with new block arguments
of types `types`.
Replaces control flow op block arguments with new block arguments of types ` types ` .
/*flatten_tuple=*/