https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91635
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |segher at gcc dot gnu.org --- Comment #21 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Jim Wilson from comment #20) > Created attachment 46830 [details] > proposed patch to fix paradoxical reg in splitter problem > > I get better code size with this alternative patch. I added two more > testcases for the issues I found while evaluating this patch. There is no > change to the rv32/newlib libc/libstdc++ library code sizes. The rv64/linux > libc.so is now 94 bytes smaller. The libstdc++.so is 6 bytes larger but > text is 10 bytes smaller and rodata is 16 bytes larger. I'm not sure what > happened there, maybe alignment padding, but I can live with it. The text > section looks like the same code, but slightly better register allocation, > which allows a few more compressed instructions to be used. This has passed > rv32/newlib and rv64/linux cross toolchain build and check. The new > testcase from Jakub still works, along with my two new testcases. > > I tried adding instrumentation to the patch to abort if I ended up with a > paradoxical reg in the splitters, and it never triggered, so it looks like > combine is doing the right thing when allocating a reg for the clobber. First of all, I think you need to use :DI instead of :GPR for the last define_split, as it shouldn't be iterated with. Second, doesn't this mean that the splitters will be matched then only during combine and never afterwards? The can_create_pseudo_p () -> gen_reg_rtx (mode) way of adding intermediate temporaries is used heavily in many other backends, just look at say i386, rs6000 or aarch64 backends for examples (I've looked only at those 3 and found many spots in each), so if missing REG_DEAD notes affect code quality, perhaps it would be more useful to try to change the combiner to add those notes (say before splitting remember highest pseudo number, after the splitter see if we've added some new pseudos and by scanning the resulting sequence see if we shouldn't add REG_DEAD notes for those somewhere, because they shouldn't be used anywhere outside of the sequence.