code: def test_sync_else_branch():
      def ir(A, B):
          ib = tvm.tir.ir_builder.create()
          Aptr = ib.buffer_ptr(A)
          Bptr = ib.buffer_ptr(B)
  
          tx = te.thread_axis("threadIdx.x")
          ib.scope_attr(tx, "thread_extent", 1)
  
          local = ib.allocate(
              A.dtype, (8,), name="buf_local", scope="local"
          )
          shared = ib.allocate(
              A.dtype, (8,), name="buf_shared", scope="shared"
          )
  
          with ib.for_range(0, 8) as i:
              with ib.if_scope(Aptr[i] < 0):
                  local[i] = Aptr[i]
              with ib.else_scope():
                  shared[i] = Aptr[i]
  
          with ib.for_range(0, 8) as i:
              with ib.if_scope(Aptr[i] < 0):
                  Bptr[i] = local[i]
              with ib.else_scope():
                  Bptr[i] = shared[i]
  
          return ib.get()
  
      A = tvm.tir.decl_buffer((8,), "float32")
      B = tvm.tir.decl_buffer((8,), "float32")
      stmt = ir(A, B)
      func = tvm.te.schedule.SchedulePostProcToPrimFunc(
          [A, B], stmt, None
      )
      mod = run_passes(func)
      assert "T.tvm_storage_sync" in str(mod)
  
file_path: tvm/tests/python/tir-transform/test_tir_transform_thread_sync.py
imports: import tvm
  import tvm.testing
  from tvm import te
  from tvm.script import tir
label_desc: Use image node_id 3 for calling a global function with example usage: test_sync_else_branch() and returns: ib