Re: [PATCH] ext-dce: Avoid multi-register paradoxical subregs for reload [PR122438]
Jeffrey Law <[email protected]>
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <[email protected]> |
On 7/31/2026 5:35 AM, Karl Mehltretter wrote: > ext-dce can turn an extension into a paradoxical subreg when the > upper bits are dead. With classic reload, this can fail if the modes > use different numbers of hard registers. On m68k, SI-to-DI creates an > invalid overlap and an ICE in postreload. > > Skip the rewrite in that case. This change also fixes PR119953 > on MSP430. LRA and same-register-count cases are unchanged. > > Cross-tested on GCC trunk: > > 1) m68k-linux-gnu: the unpatched compiler reproduces PR122438. The > gcc.target/m68k suite changes from 128 PASS / 9 FAIL / 1 unsupported > to 129 PASS / 9 FAIL / 1 unsupported with the new test. > > 2) msp430-elf: the new PR119953 test passes. > > 3) alpha-linux-gnu and vax-netbsdelf: the tested same-register-count > extension cases produce identical assembly with and without the patch. > > Also tested on GCC 16.1.1 for m68k-linux-gnu. The unpatched compiler > reproduces PR122438 while the new test passes with the patch. > > Assisted-by: Codex gpt-5.6-terra > > gcc/ChangeLog: > > PR rtl-optimization/122438 > PR target/119953 > * ext-dce.cc: Include regs.h. > (ext_dce_try_optimize_extension): Avoid multi-register > paradoxical subregs with classic reload. > > gcc/testsuite/ChangeLog: > > PR rtl-optimization/122438 > PR target/119953 > * gcc.target/m68k/pr122438.c: New test. > * g++.target/msp430/pr119953.C: New test. This seems like it's just working around bugs elsewhere, particularly the targets and/or reload. But that's a first glance at the patch. What I would want to see to approve this is an analysis indicating how/why the transformed RTL is incorrect. jeff