code: def test_keep_only_referenced_prelude_functions():
      mod = tvm.IRModule()
      p = Prelude(mod)
      _, cons, nil = p.mod.get_type("List")
      hd = p.mod.get_global_var("hd")
      tl = p.mod.get_global_var("tl")
      l = nil()
      for i in [4, 3, 2, 1, 0]:
          l = cons(relay.const(i), l)
      body = hd(tl(tl(l)))
      mod["main"] = relay.Function([], body)
      mod = relay.transform.RemoveUnusedFunctions()(mod)
      l = set([x[0].name_hint for x in mod.functions.items()])
      assert l == set(["tl", "hd", "main"])
  
file_path: tvm/tests/python/relay/test_pass_remove_unused_functions.py
imports: import pytest
  import tvm
  from tvm import te
  from tvm import relay
  from tvm.relay import transform
  from tvm.relay.prelude import Prelude
label_desc: Use image node_id 3 for calling a global function with example usage: test_keep_only_referenced_prelude_functions() without return types