diff options
| author | Roman Lebedev <lebedev.ri@gmail.com> | 2020-09-17 11:08:26 +0300 |
|---|---|---|
| committer | Roman Lebedev <lebedev.ri@gmail.com> | 2020-09-17 11:29:03 +0300 |
| commit | aadf55d1cea24a4e5384ab8546c3d794cb1ec724 (patch) | |
| tree | b073689ab09b312cd1ce80b48365ab63945402a1 /llvm/lib/CodeGen/ModuloSchedule.cpp | |
| parent | 6f6d389da5c37e5e9a900902f03dc649d57919b7 (diff) | |
| download | llvm-aadf55d1cea24a4e5384ab8546c3d794cb1ec724.zip llvm-aadf55d1cea24a4e5384ab8546c3d794cb1ec724.tar.gz llvm-aadf55d1cea24a4e5384ab8546c3d794cb1ec724.tar.bz2 | |
[NFC] EliminateDuplicatePHINodes(): small-size optimization: if there are <= 32 PHI's, O(n^2) algo is faster (geomean -0.08%)
This is functionally equivalent to the old implementation.
As per https://llvm-compile-time-tracker.com/compare.php?from=5f4e9bf6416e45eba483a4e5e263749989fdb3b3&to=4739e6e4eb54d3736e6457249c0919b30f6c855a&stat=instructions
this is a clear geomean compile-time regression-free win with overall geomean of `-0.08%`
32 PHI's appears to be the sweet spot; both the 16 and 64 performed worse:
https://llvm-compile-time-tracker.com/compare.php?from=5f4e9bf6416e45eba483a4e5e263749989fdb3b3&to=c4efe1fbbfdf0305ac26cd19eacb0c7774cdf60e&stat=instructions
https://llvm-compile-time-tracker.com/compare.php?from=5f4e9bf6416e45eba483a4e5e263749989fdb3b3&to=e4989d1c67010d3339d1a40ff5286a31f10cfe82&stat=instructions
If we have more PHI's than that, we fall-back to the original DenseSet-based implementation,
so the not-so-fast cases will still be handled.
However compile-time isn't the main motivation here.
I can name at least 3 limitations of this CSE:
1. Assumes that all PHI nodes have incoming basic blocks in the same order (can be fixed while keeping the DenseMap)
2. Does not special-handle `undef` incoming values (i don't see how we can do this with hashing)
3. Does not special-handle backedge incoming values (maybe can be fixed by hashing backedge as some magical value)
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D87408
Diffstat (limited to 'llvm/lib/CodeGen/ModuloSchedule.cpp')
0 files changed, 0 insertions, 0 deletions
