The pre-commit testing showed that making ext-dce only active at -O2 and
above would require minor edits to the tests. In some cases we had
specified -O1 in the test or specified no optimization level at all.
Those need to be bumped to -O2. In one test we had one set of
dg-options overriding another.
The other approach that could have been taken would be to drop the -On
argument, add an explicit -fext-dce and add dg-skip-if options. I
originally thought that was going to be way to go, but the dg-skip-if
aspect was going to get ugly as things like interaction between
unrolling, peeling and -ftracer would have to be accounted for and would
likely need semi-regular adjustment.
Changes since V2:
Testsuite changes to deal with pass only being enabled at -O2 or
higher.
--
Changes since V1:
Check flag_ext_dce before running the new pass. I'd forgotten that
I had removed that part of the gate to facilitate more testing.
Turn flag_ext_dce on at -O2 and above.
Adjust one of the riscv tests to explicitly avoid vectors
Adjust a few aarch64 tests
In tbz_2.c we remove an unnecessary extension which causes us to use
"x" registers instead of "w" registers.
In the pred_clobber tests we also remove an extension and that
ultimately causes a reg->reg copy to change locations.
--
This was actually ack'd late in the gcc-14 cycle, but I chose not to
integrate it given how late we were in the cycle.
The basic idea here is to track liveness of subobjects within a word and
if we find an extension where the bits set aren't actually used, then we
convert the extension into a subreg. The subreg typically simplifies away.
I've seen this help a few routines in coremark, fix one bug in the
testsuite (pr111384) and fix a couple internally reported bugs in Ventana.
The original idea and code were from Joern; Jivan and I hacked it into
usable shape. I've had this in my tester for ~8 months, so it's been
through more build/test cycles than I care to contemplate and nearly
every architecture we support.
But just in case, I'm going to wait for it to spin through the
pre-commit CI tester. I'll find my old ChangeLog before committing.