From ee8b6568e8cd0ee7ff1a404993fa95dae4041365 Mon Sep 17 00:00:00 2001 From: FindHao Date: Sun, 26 Oct 2025 18:33:18 -0400 Subject: [PATCH] Fix main #loc storage key conflict Change main #loc storage key from "1" to "" (empty string) to avoid collision with #loc1. This resolves the issue where #loc1 would overwrite the main #loc entry when both exist in the IR file. The main #loc directive appears as `#loc = loc(...)` without a number, while numbered directives appear as `#loc1 = loc(...)`, `#loc2 = loc(...)`, etc. Using "" as the key for the main directive prevents conflicts. --- tritonparse/ir_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tritonparse/ir_parser.py b/tritonparse/ir_parser.py index 7751169..58cb478 100644 --- a/tritonparse/ir_parser.py +++ b/tritonparse/ir_parser.py @@ -52,7 +52,7 @@ def extract_loc_definitions(ir_content: str) -> Dict[str, Dict[str, Any]]: # The first #loc directive is a special case. It locates at the top of the IR files main_match = re.search(r'#loc = loc\("([^"]+)":(\d+):(\d+)\)', ir_content) if main_match: - locations["1"] = { + locations[""] = { "file": main_match.group(1), "line": int(main_match.group(2)), "column": int(main_match.group(3)),