Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant IR generation of constants and unused IR main inlining #5998

Merged
merged 2 commits into from
May 13, 2024

Conversation

ironcev
Copy link
Member

@ironcev ironcev commented May 13, 2024

Description

This PR:

  • removes the redundant calls to compile_declarations function and the function itself. The function was used in early versions of Sway, but the way we compile items to IR has changed: functions are compiled at call site, and structs and enums are inlined at instantiation site. In the end, the function was only compiling constants, but that was already done in the dedicated compile_constants calls.
  • removes the inline_main optimization which was aggressively inlining the whole program into main function. This was a necessity in early versions of Sway and is not used anymore.

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@ironcev ironcev self-assigned this May 13, 2024
@ironcev ironcev added compiler General compiler. Should eventually become more specific as the issue is triaged code quality compiler: ir IRgen and sway-ir including optimization passes compiler: optimization IR Optimization Passes labels May 13, 2024
Copy link

Benchmark for 44d5a37

Click to view benchmark
Test Base PR %
code_action 5.4±0.02ms 5.4±0.04ms 0.00%
code_lens 290.9±9.71ns 293.4±9.39ns +0.86%
compile 2.9±0.05s 2.9±0.03s 0.00%
completion 4.7±0.08ms 4.7±0.08ms 0.00%
did_change_with_caching 2.8±0.03s 2.8±0.03s 0.00%
document_symbol 936.1±34.81µs 1077.8±36.03µs +15.14%
format 76.9±1.12ms 77.2±0.57ms +0.39%
goto_definition 359.7±23.26µs 376.6±6.33µs +4.70%
highlight 9.0±0.09ms 9.2±0.20ms +2.22%
hover 468.3±18.26µs 483.4±4.95µs +3.22%
idents_at_position 124.9±0.73µs 122.1±0.74µs -2.24%
inlay_hints 649.8±12.18µs 678.5±38.63µs +4.42%
on_enter 494.0±14.29ns 496.2±11.32ns +0.45%
parent_decl_at_position 3.7±0.09ms 3.7±0.04ms 0.00%
prepare_rename 351.3±5.50µs 365.4±7.32µs +4.01%
rename 9.6±0.12ms 9.6±0.18ms 0.00%
semantic_tokens 1016.0±8.32µs 1033.4±16.95µs +1.71%
token_at_position 354.2±2.41µs 359.7±1.78µs +1.55%
tokens_at_position 3.7±0.04ms 3.7±0.05ms 0.00%
tokens_for_file 421.7±1.54µs 419.8±2.48µs -0.45%
traverse 41.7±0.93ms 42.1±1.00ms +0.96%

@ironcev ironcev marked this pull request as ready for review May 13, 2024 13:55
@ironcev ironcev requested review from vaivaswatha and a team May 13, 2024 13:55
@ironcev ironcev enabled auto-merge (squash) May 13, 2024 13:55
@ironcev ironcev requested a review from a team May 13, 2024 14:14
@ironcev ironcev merged commit 8148817 into master May 13, 2024
38 checks passed
@ironcev ironcev deleted the ironcev/remove-dead-ir-generation-code branch May 13, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality compiler: ir IRgen and sway-ir including optimization passes compiler: optimization IR Optimization Passes compiler General compiler. Should eventually become more specific as the issue is triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants