Skip to content

Preserve source locations in optimization passes - #4747

Merged
copybara-service[bot] merged 4 commits into
google:mainfrom
antmicro:101465-preserve-pos
Sep 10, 2026
Merged

copybara-service[bot] merged 4 commits into
google:mainfrom
antmicro:101465-preserve-pos

Conversation

@rw1nkler

Copy link
Copy Markdown
Contributor

This PR adds a MergeLocs helper that merges and deduplicates source locations across a node's operands.
It's used wherever passes synthesize replacement nodes, since those call sites often dropped the
original location, making it harder to trace optimized IR and generated Verilog back to the source DSLX.
VastNode::PreEmit is also updated to emit one comment per merged location, with line-count tracking
adjusted accordingly. Tests cover MergeLocs and each annotation strategy end to end.

@ericastor ericastor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great step forward, thank you!

Comment thread xls/ir/node_util.cc Outdated
@proppy

proppy commented Aug 27, 2026

Copy link
Copy Markdown
Member

can we rebase?

@rw1nkler
rw1nkler force-pushed the 101465-preserve-pos branch 2 times, most recently from c9ab772 to 0a26f3c Compare September 9, 2026 15:13
@rw1nkler
rw1nkler requested a review from ericastor September 9, 2026 15:14
@ericastor

Copy link
Copy Markdown
Contributor

This seems to have a failing test: StrategyCommentEmitsLocationComments?

Internal-tag: [#101465]
Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
Internal-tag: [#101465]
Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
Internal-tag: [#101465]
Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
Internal-tag: [#101465]
Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
@copybara-service
copybara-service Bot merged commit 712c440 into google:main Sep 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants