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

[ELF] ICF optimizations and simplifications #845

Merged
merged 3 commits into from
Nov 1, 2022

Conversation

ishitatsuyuki
Copy link
Contributor

Implements the low-hanging fruit from #842, and a few additional simplifications while on it.

A node converges if its descendants contains no cycles and its hash has reached
all its descendants. Previously we checked for convergence on each iteration by
comparing hashes, but this could be tracked more cheaply through a separate
bitset.

This improves cache efficiency and results in a ~50ms speed up for Chromium out
of 310ms for the ICF pass.

Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
This isn't perf intensive at all but sweeping through the sections seems
to be the more obvious way compared to going through the symbol
indirections.

Also, reword the comments and timing name to better reflect what it's
doing.

FWIW, it's slightly (5ms) faster.

Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
We can already print them, but a counter is more handy when the
executable is large and dumping everything would be too much.

Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
@rui314
Copy link
Owner

rui314 commented Nov 1, 2022

I wonder if you can use std::vector<bool> instead. IIUC, std::vector is specialized for bool so that it uses only one bit for each element.

@ishitatsuyuki
Copy link
Contributor Author

The specialization on std::vector<bool> was long removed since C++11 because how much hassle it added to the semantics, e.g. not being able to give out proper pointers.

@ishitatsuyuki
Copy link
Contributor Author

Hm actually it wasn't removed (the proposal was rejected), but it's widely considered a mistake anyway and I don't think it's worth using given it lacks ability to do a fast "count last zero" operation anyway.

@rui314 rui314 merged commit 1277580 into rui314:main Nov 1, 2022
@ishitatsuyuki ishitatsuyuki deleted the icf-opt1 branch November 1, 2022 02:43
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.

2 participants