diff options
author | pvanhout <pierre.vanhoutryve@amd.com> | 2023-08-03 16:24:47 +0200 |
---|---|---|
committer | pvanhout <pierre.vanhoutryve@amd.com> | 2023-08-03 16:41:11 +0200 |
commit | 62ea799e6c798e84428d77bc84b83fc572b7d75e (patch) | |
tree | 24390ec50ca4ba0bc28acf7d52024b9e18d2e393 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 46642cc83dc575962e1a6eb557714319c65ca5b8 (diff) | |
download | llvm-62ea799e6c798e84428d77bc84b83fc572b7d75e.zip llvm-62ea799e6c798e84428d77bc84b83fc572b7d75e.tar.gz llvm-62ea799e6c798e84428d77bc84b83fc572b7d75e.tar.bz2 |
[AMDGPU] Break Large PHIs: Take whole PHI chains into account
Previous heuristics had a big flaw: they only looked at single PHI at a time, and didn't take into account the whole "chain".
The concept of "chain" is important because if we only break a chain partially, we risk forcing regalloc to reserve twice as many registers for that vector.
We also risk adding a lot of copies that shouldn't be there and can inhibit backend optimizations.
The solution I found is to consider the whole "PHI chain" when looking at PHI.
That is, we recursively look at the PHI's incoming value & users for other PHIs, then make a decision about the chain as a whole.
The currrent threshold requires that at least `ceil(chain size * (2/3))` PHIs have at least one interesting incoming value.
In simple terms, two-thirds (rounded up) of the PHIs should be breakable.
This seems to work well. A lower threshold such as 50% is too aggressive because chains can often have 7 or 9 PHIs, and breaking 3+ or 4+ PHIs in those case often causes performance issue.
Fixes SWDEV-409648, SWDEV-398393, SWDEV-413487
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D156414
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions