On Tue, Jul 14, 2020 at 04:33:42PM -0500, Segher Boessenkool wrote: > > If combine only did lower-cost combinations (perhaps with > > Richard Sandifords lower-size-when-tied suggestion), I guess > > this wouldn't happen. 0:-) > > And we would regress (a LOT).
Like this. C0 is an unmodified compiler. C1 is with the single_set modification to is_just_move I committed a minute ago (84c5396d4bdb). C2 is with this patch: -- 8< -- diff --git a/gcc/combine.c b/gcc/combine.c index 3a81bb6..619ba77 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -939,7 +939,7 @@ combine_validate_cost (rtx_insn *i0, rtx_insn *i1, rtx_insn /* Disallow this combination if both new_cost and old_cost are greater than zero, and new_cost is greater than old cost. */ - int reject = old_cost > 0 && new_cost > old_cost; + int reject = old_cost > 0 && new_cost >= old_cost; if (dump_file) { -- 8< -- [segher@gcc135 buildall]$ perl sizes.pl --percent C[012] C0 C1 C2 alpha 6045560 100.000% 100.518% arc 3529016 100.000% 99.933% arm 14173370 100.000% 101.607% arm64 12958466 100.000% 100.477% c6x 2341205 100.000% 100.154% csky 3320386 100.000% 100.838% h8300 1163584 100.000% 100.331% i386 0 0 0 ia64 18079744 100.000% 100.857% m68k 3711195 100.000% 100.327% microblaze 4930937 100.000% 100.054% mips 8403293 100.000% 100.049% mips64 6975860 100.000% 99.986% nds32 4450951 100.000% 99.992% nios2 3641733 100.000% 100.206% openrisc 4182260 100.000% 100.025% parisc 7706299 100.000% 101.500% parisc64 8677365 100.000% 101.491% powerpc 10016575 100.000% 100.001% powerpc64 17331518 100.000% 99.974% powerpc64le 17331518 100.000% 99.974% riscv32 0 0 0 riscv64 0 0 0 s390 13091897 100.000% 100.396% sh 3213207 100.000% 100.031% shnommu 1610444 100.000% 100.031% sparc 4356641 100.000% 101.521% sparc64 6745123 100.000% 101.450% x86_64 19663507 100.000% 100.007% xtensa 2105610 100.000% 100.425% Segher