diff options
author | Jeff Law <jlaw@ventanamicro.com> | 2024-07-25 12:32:28 -0600 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2024-07-28 19:05:58 +0200 |
commit | 6f1ab8976f4b169922645c802fc17277f01dc67d (patch) | |
tree | baa44ae1d12ca3f74b9cd6d00cf4946cae4ea4d1 /libcpp | |
parent | a68e9d31f80ac189053319dd65095988ceb3336a (diff) | |
download | gcc-6f1ab8976f4b169922645c802fc17277f01dc67d.zip gcc-6f1ab8976f4b169922645c802fc17277f01dc67d.tar.gz gcc-6f1ab8976f4b169922645c802fc17277f01dc67d.tar.bz2 |
[PR rtl-optimization/116039] Fix life computation for promoted subregs
So this turned out to be a neat little test and while the fuzzer found it on
RISC-V, I wouldn't be surprised if the underlying issue is also the root cause
of the loongarch issue with ext-dce.
The key issue is that if we have something like
(set (dest) (any_extend (subreg (source))))
If the subreg object is marked with SUBREG_PROMOTED and the sign/unsigned state
matches the any_extend opcode, then combine (and I guess anything using
simplify-rtx) may simplify that to
(set (dest) (source))
That implies that bits outside the mode of the subreg are actually live and
valid. This needs to be accounted for during liveness computation.
We have to be careful here though. If we're too conservative about setting
additional bits live, then we'll inhibit the desired optimization in the
coremark examples. To do a good job we need to know the extension opcode.
I'm extremely unhappy with how the use handling works in ext-dce. It mixes
different conceptual steps and has horribly complex control flow. It only
handles a subset of the unary/binary opcodes, etc etc. It's just damn mess.
It's going to need some more noodling around.
In the mean time this is a bit hacky in that it depends on non-obvious behavior
to know it can get the extension opcode, but I don't want to leave the trunk in
a broken state while I figure out the refactoring problem.
Bootstrapped and regression tested on x86 and tested on the crosses. Pushing to the trunk.
PR rtl-optimization/116039
gcc/
* ext-dce.cc (ext_dce_process_uses): Add some comments about concerns
with current code. Mark additional bit groups as live when we have
an extension of a suitably promoted subreg.
gcc/testsuite
* gcc.dg/torture/pr116039.c: New test.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions