Set visibility of outlined function as private during ClusterOutliningPass.

PiperOrigin-RevId: 305691287
Change-Id: Ib53ed2aaacdb6b95a8e2b5a5013b413931913adb
This commit is contained in:
Prakalp Srivastava 2020-04-09 08:44:51 -07:00 committed by TensorFlower Gardener
parent 15c0cb71fe
commit fbac644835
2 changed files with 5 additions and 0 deletions

View File

@ -27,6 +27,7 @@ module {
// CHECK-LABEL: func @tpu0_func
// CHECK-SAME: (%[[TPU0_FUNC_ARG_0:[a-z0-9]*]]: tensor<?xi32>) -> tensor<?xi32>
// CHECK-SAME: sym_visibility = "private"
// CHECK: %[[TPU0_FUNC_B_OUTPUT:[0-9]*]] = "tf.B"(%[[TPU0_FUNC_ARG_0]])
// CHECK: return %[[TPU0_FUNC_B_OUTPUT]]
}

View File

@ -66,6 +66,10 @@ FuncOp BuildFunction(StringRef device, llvm::ArrayRef<Value> live_ins,
FuncOp outlined_func =
FuncOp::create(launch_op.getLoc(), func_name_prefix, func_type);
// This function is not externally visible and marking it private would allow
// symbol-dce pass to remove it when it is not referenced anymore.
outlined_func.setVisibility(FuncOp::Visibility::Private);
// Create function body.
Block* outlined_func_block = outlined_func.addEntryBlock();