I’ve recompiled TF on a fresh master version:
bazel build tensorflow/compiler/aot:tfcompile

export XLA_FLAGS="--xla_hlo_profile --xla_dump_to=/tmp/foo --xla_dump_hlo_as_text" ;

bazel-bin/tensorflow/compiler/aot/tfcompile --graph=./tensorflow/compiler/aot/test_graph_tfadd.pbtxt --config=tensorflow/compiler/aot/test_graph_tfadd.config.pbtxt --cpp_class="myns::test"

ls -1 /tmp/foo/

1627458376191776.module_0000.tfcompile.8.before_optimizations.txt
1627458376191776.module_0000.tfcompile.8.cpu_after_optimizations-buffer-assignment.txt
1627458376191776.module_0000.tfcompile.8.cpu_after_optimizations.txt
execution_options.txt
module_0000.tfcompile.8.buffer_assignment
module_0000.tfcompile.8.ir-no-opt-noconst.ll
module_0000.tfcompile.8.ir-no-opt.ll
module_0000.tfcompile.8.ir-with-opt-noconst.ll
module_0000.tfcompile.8.ir-with-opt.ll
module_0000.tfcompile.8.o

It seems to work, so with bazel have you tried to set the envs with:

  
      

      bazel.build
  

  
    

Specifying environment variables - Bazel 3