[REFACTOR][IR] Cleanup IR naming utilities#19781
Conversation
IR module cleanup benefits from using a single unique-name primitive directly at module call sites. This renames NameSupply to UniqueNameSupply, removes the GlobalVarSupply wrapper and obsolete access-path repr registration, and updates the affected Python wrapper and tests.
There was a problem hiding this comment.
Code Review
This pull request refactors the codebase by replacing NameSupply and GlobalVarSupply with a unified UniqueNameSupply class, which uses ffi::Map instead of std::unordered_map for name tracking. The review feedback identifies a potential null pointer dereference in UniqueNameSupply when name_map is not defined, a redundant name reservation in src/ir/module.cc, and a minor typo in a comment within src/target/source/codegen_c.h.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
UniqueNameSupply should treat an explicitly undefined map the same as an empty map. This keeps the constructor robust while preserving the default empty-map behavior.
IR module cleanup benefits from using a single unique-name primitive directly at module call sites. This PR renames NameSupply to UniqueNameSupply and removes redundant wrappers around global variable naming. Main changes: - Rename the public name supply API and header to UniqueNameSupply - Replace GlobalVarSupply with direct iterator-seeded UniqueNameSupply usage - Remove obsolete access-path repr registration now covered by tvm-ffi
IR module cleanup benefits from using a single unique-name primitive directly at module call sites. This PR renames NameSupply to UniqueNameSupply and removes redundant wrappers around global variable naming.
Main changes: