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

Improve IR compilation performance #18282

Merged
merged 2 commits into from Oct 1, 2023

Conversation

unknownbrackets
Copy link
Collaborator

This improves compilation speed (as seen using freeze frame.) A lot of time was spent in the GetIRMeta() lookup, and caching it ends up being worthwhile in the cases where it's called a lot.

A surprising amount of time is spent in FindBestToSpill() still, it might make sense to cache some spill information at block start instead.

The IRInst struct duplication is a bit non-ideal, but I didn't want to make everything inst.i.src1 and etc. I added a static assert, at least, to hopefully catch if one is updated without the other. I wish C++ had some way to alias fields easily (or maybe it does and I just don't know of it...)

-[Unknown]

As I guessed, this was expensive.  using a vector and reserve isn't very.
It's nice to keep this before logBlocks_ is > 0, in case it's set mid
block.
This improves compilation performance, because all those lookups were
adding up.
@unknownbrackets unknownbrackets added this to the v1.17.0 milestone Sep 30, 2023
@hrydgard
Copy link
Owner

hrydgard commented Oct 1, 2023

Well aliasing fields is done with anonymous (or not anonymous, depending on preference) unions, which is what you're doing - I don't know in what other ways they could be aliased?

@hrydgard
Copy link
Owner

hrydgard commented Oct 1, 2023

Maybe should add a comment that the struct you union IRInst with needs to be kept in sync with the original IRInst, although can do in a later commit.

@hrydgard hrydgard merged commit db805cc into hrydgard:master Oct 1, 2023
18 checks passed
@unknownbrackets unknownbrackets deleted the ir-compiling branch October 8, 2023 19:50
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.

None yet

2 participants