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

Initialise large enough, same-const-initialised, arrays using loops #5240

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

vaivaswatha
Copy link
Contributor

Description

Closes #5229

Previously, these arrays were initialised with repeated "load index from data area, store initialise constant to array". Now we just use a loop to store the constant initialise to every element of the array. To avoid overheads of the loop, it's only done, currently, when the array size is greater than 5 (can be tuned later).

@vaivaswatha vaivaswatha added the compiler: optimization IR Optimization Passes label Oct 30, 2023
@vaivaswatha vaivaswatha requested a review from a team October 30, 2023 12:20
@vaivaswatha vaivaswatha self-assigned this Oct 30, 2023
@IGI-111 IGI-111 requested a review from a team October 30, 2023 13:29
@tritao
Copy link
Contributor

tritao commented Oct 30, 2023

Maybe I am misunderstanding, but the test doesn't actually check that the optimization is working right?

We would need an IR test for that?

@vaivaswatha
Copy link
Contributor Author

vaivaswatha commented Oct 30, 2023

Maybe I am misunderstanding, but the test doesn't actually check that the optimization is working right?

You're right, it just checks that, if the optimisation happens, it doesn't end up being incorrect.

We would need an IR test for that?

Ideally yes. The problem is that this isn't really an optimisation pass. It's just a different IR gen, so I can't test it using opt, like how we test the other optimisation passes :-(.

@vaivaswatha vaivaswatha merged commit f979b18 into master Oct 30, 2023
31 checks passed
@vaivaswatha vaivaswatha deleted the vaivaswatha/array_init_5229 branch October 30, 2023 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: optimization IR Optimization Passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize array initializations
3 participants