Skip to content

Provide unique name from closures with same name#488

Merged
kvpanch merged 6 commits intomainfrom
kvpanch/issue_474
Mar 10, 2026
Merged

Provide unique name from closures with same name#488
kvpanch merged 6 commits intomainfrom
kvpanch/issue_474

Conversation

@kvpanch
Copy link
Contributor

@kvpanch kvpanch commented Mar 4, 2026

In YUL it's possible to declare closure with a same name, but in different scope, which previously resulted to func name conflict during LLVM IR construction.
To solve this, track YUL scope when building LLVM IR and a special counter that increments every time function with the same name exists in LLVM module.
There's still assert if somehow within the same scope there 2 functions with the same name, which should be forbidden by Yul

Fixes: #474

In YUL it's possible to declare closure with a same name, but in
different scope, which previously resulted to func name conflict during LLVM
IR construction.
To solve this, track YUL scope when building LLVM IR and a special
counter that increments every time function with the same name exists in
LLVM module.
There's still assert if somehow within the same scope there 2 functions
with the same name, which should be forbidden by Yul

Fixes: #474
@kvpanch kvpanch requested review from elle-j and xermicus March 4, 2026 20:01
kvpanch and others added 2 commits March 8, 2026 21:21
Co-authored-by: LJ <81748770+elle-j@users.noreply.github.com>
Co-authored-by: LJ <81748770+elle-j@users.noreply.github.com>
Copy link
Contributor

@elle-j elle-j left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@xermicus xermicus left a comment

Choose a reason for hiding this comment

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

Thanks! The logic looks good to me, couldn't find an obvious issue. However some integration test with mangled functions, to ensure the mangling logic works correctly, would be nice to have

@kvpanch kvpanch merged commit 61ac247 into main Mar 10, 2026
14 checks passed
@xermicus xermicus deleted the kvpanch/issue_474 branch March 12, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE same-named Yul functions in sibling blocks

3 participants