This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 0/2][IRA,LRA] Fix PR86939, IRA incorrectly creates an interference between a pseudo register and a hard register
On Tue, Oct 2, 2018 at 12:44 PM Peter Bergner <bergner@linux.ibm.com> wrote:
>
> On 10/2/18 9:59 AM, Peter Bergner wrote:
> > gcc/
> > PR rtl-optimization/86939
> > PR rtl-optimization/87479
> > * ira.h (copy_insn_p): New prototype.
> > * ira-lives.c (ignore_reg_for_conflicts): New static variable.
> > (make_hard_regno_dead): Don't add conflicts for register
> > ignore_reg_for_conflicts.
> > (make_object_dead): Likewise.
> > (copy_insn_p): New function.
> > (process_bb_node_lives): Set ignore_reg_for_conflicts for copies.
> > Remove special conflict handling of REAL_PIC_OFFSET_TABLE_REGNUM.
> > * lra-lives.c (ignore_reg_for_conflicts): New static variable.
> > (make_hard_regno_dead): Don't add conflicts for register
> > ignore_reg_for_conflicts. Remove special conflict handling of
> > REAL_PIC_OFFSET_TABLE_REGNUM. Remove now unused argument
> > check_pic_pseudo_p and update callers.
> > (mark_pseudo_dead): Don't add conflicts for register
> > ignore_reg_for_conflicts.
> > (process_bb_lives): Set ignore_reg_for_conflicts for copies.
>
> So bootstrap and regtesting on powerpc64le-linux show no regressions.
> Looking at the x86_64-linux results, I see one test suite regression:
>
> FAIL: gcc.target/i386/pr49095.c scan-assembler-times \\), % 8
>
> I have included the function that is compiled differently with and
> without the patch. Looking at the IRA rtl dumps, there is pseudo
> 85 that is copied from and into hard reg 5 and we now no longer
> report that they conflict. That allows pesudo 85 to now be assigned
> to hard reg 5, rather than hard reg 3 (old code) and that leads
> to the code differences shown below. I don't know x86_64 mnemonics
> enough to say whether the code changes below are "better" or "similar"
> or ???. H.J., can you comment on the below code gen changes?
> If they're better or similar to the old code, I could just modify
> the expected results for pr49095.c.
>
> Peter
>
>
>
> [bergner@dagger1 PR87479]$ cat pr49095.i
> void foo (void *);
>
> int *
> f1 (int *x)
> {
> if (!--*x)
> foo (x);
> return x;
> }
> [bergner@dagger1 PR87479]$ /data/bergner/gcc/build/gcc-fsf-mainline-pr87479-base-regtest/gcc/xgcc -B/data/bergner/gcc/build/gcc-fsf-mainline-pr87479-base-regtest/gcc/ -Os -fno-shrink-wrap -masm=att -ffat-lto-objects -fno-ident -S -o pr49095-base.s pr49095.i
> [bergner@dagger1 PR87479]$ /data/bergner/gcc/build/gcc-fsf-mainline-pr87479-regtest/gcc/xgcc -B/data/bergner/gcc/build/gcc-fsf-mainline-pr87479-regtest/gcc/ -Os -fno-shrink-wrap -masm=att -ffat-lto-objects -fno-ident -S -o pr49095-new.s pr49095.i
> [bergner@dagger1 PR87479]$ diff -u pr49095-base.s pr49095-new.s
> --- pr49095-base.s 2018-10-02 14:07:09.000000000 -0500
> +++ pr49095-new.s 2018-10-02 14:07:40.000000000 -0500
> @@ -5,16 +5,16 @@
> f1:
> .LFB0:
> .cfi_startproc
> + subq $24, %rsp
> + .cfi_def_cfa_offset 32
> decl (%rdi)
> - pushq %rbx
> - .cfi_def_cfa_offset 16
> - .cfi_offset 3, -16
> - movq %rdi, %rbx
> jne .L2
> + movq %rdi, 8(%rsp)
> call foo
> + movq 8(%rsp), %rdi
> .L2:
> - movq %rbx, %rax
> - popq %rbx
> + movq %rdi, %rax
> + addq $24, %rsp
> .cfi_def_cfa_offset 8
> ret
> .cfi_endproc
>
I saw the same failures:
FAIL: gcc.target/i386/pr49095.c scan-assembler-times \\), % 8
FAIL: gcc.target/i386/pr49095.c scan-assembler-times \\), % 8
I think the new ones are better, especially in 32-bit case:
Old:
[hjl@gnu-cfl-1 gcc]$ ./xgcc -B./
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.target/i386/pr49095.c
-m32 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
-fdiagnostics-color=never -Os -fno-shrink-wrap -masm=att -mregparm=2
-ffat-lto-objects -fno-ident -S -o pr49095.s
[hjl@gnu-cfl-1 gcc]$ wc -l pr49095.s
2314 pr49095.s
[hjl@gnu-cfl-1 gcc]$
New:
[hjl@gnu-skl-1 gcc]$ ./xgcc -B./
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.target/i386/pr49095.c
-m32 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
-fdiagnostics-color=never -Os -fno-shrink-wrap -masm=att -mregparm=2
-ffat-lto-objects -fno-ident -S -o pr49095.s
[hjl@gnu-skl-1 gcc]$ wc -l pr49095.s
2163 pr49095.s
[hjl@gnu-skl-1 gcc]$
--
H.J.
- References:
- Re: [PATCH 0/2][IRA,LRA] Fix PR86939, IRA incorrectly creates an interference between a pseudo register and a hard register
- Re: [PATCH 0/2][IRA,LRA] Fix PR86939, IRA incorrectly creates an interference between a pseudo register and a hard register
- Re: [PATCH 0/2][IRA,LRA] Fix PR86939, IRA incorrectly creates an interference between a pseudo register and a hard register
- Re: [PATCH 0/2][IRA,LRA] Fix PR86939, IRA incorrectly creates an interference between a pseudo register and a hard register
- Re: [PATCH 0/2][IRA,LRA] Fix PR86939, IRA incorrectly creates an interference between a pseudo register and a hard register
- Re: [PATCH 0/2][IRA,LRA] Fix PR86939, IRA incorrectly creates an interference between a pseudo register and a hard register
- Re: [PATCH 0/2][IRA,LRA] Fix PR86939, IRA incorrectly creates an interference between a pseudo register and a hard register