code: def test_replace_copy():
      s, target = replace_ir_builder(deep_copy=True, realize=True)
      old_hash = s.mod["main"].__hash__()
      # We hold another reference of func
      old_func = s.mod["main"]
      sref = s.get_sref(s.mod["main"].body.block.body[0])
      s.replace(sref, target)
      # We need to copy the whole func to remain the old_func unchanged
      assert old_hash != s.mod["main"].__hash__()
      assert not tvm.ir.structural_equal(
          old_func.body, s.mod["main"].body
      )
      assert old_hash == old_func.__hash__()
      # Check the replaced part is equal to the target
      tvm.ir.assert_structural_equal(
          s.mod["main"].body.block.body[0], target
      )
      # The replaced AST node will be deleted, so the ref will be None
      assert sref.stmt is None
  
imports: import gc
  import sys
  import pytest
  import tvm
  import tvm.testing
  from tvm import tir
  from tvm.ir import IRModule
  from tvm.script import tir
label_desc: Use image node_id 9 for calling a global function with example usage: test_replace_copy() without return types