[Bug rtl-optimization/103541] unnecessary spills around const functions calls

2023-02-09 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103541

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Vladimir Makarov :

https://gcc.gnu.org/g:10827a92f1a8c3207b327515f77845b34c1d9512

commit r13-5761-g10827a92f1a8c3207b327515f77845b34c1d9512
Author: Vladimir N. Makarov 
Date:   Thu Feb 9 15:18:48 2023 -0500

RA: Implement reuse of equivalent memory for caller saves optimization (2nd
version)

The test pr103541.c shows opportunity to reuse memory with constant address
for
caller saves optimization for constant or pure function call.  The patch
implements the memory reuse.

PR rtl-optimization/103541
PR rtl-optimization/108711

gcc/ChangeLog:

* ira.h (struct ira_reg_equiv_s): Add new field caller_save_p.
* ira.cc (validate_equiv_mem): Check memref address variance.
(no_equiv): Clear caller_save_p flag.
(update_equiv_regs): Define caller save equivalence for
valid_combine.
(setup_reg_equiv): Clear defined_p flag for caller save
equivalence.
* lra-constraints.cc (lra_copy_reg_equiv): Add new arg
call_save_p.  Use caller save equivalence depending on the arg.
(split_reg): Adjust the call.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr103541.c: New.
* g++.target/i386/pr108711.C: New.

[Bug rtl-optimization/103541] unnecessary spills around const functions calls

2023-02-08 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103541

--- Comment #6 from H.J. Lu  ---
The change has been reverted by r13-5738-gad2bd0ad0413c2448fee0d4a

[Bug rtl-optimization/103541] unnecessary spills around const functions calls

2023-02-07 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103541

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Vladimir Makarov :

https://gcc.gnu.org/g:f661c0bb6371f355966a67b5ce71398e80792948

commit r13-5730-gf661c0bb6371f355966a67b5ce71398e80792948
Author: Vladimir N. Makarov 
Date:   Tue Feb 7 08:27:36 2023 -0500

RA: Implement reuse of equivalent memory for caller saves optimization

The test case shows opportunity to reuse memory with constant address for
caller saves optimization for constant or pure function call.  The patch
implements the memory reuse.

PR rtl-optimization/103541

gcc/ChangeLog:

* ira.h (struct ira_reg_equiv_s): Add new field caller_save_p.
* ira.cc (validate_equiv_mem): Check memref address variance.
(update_equiv_regs): Define caller save equivalence for
valid_combine.
(setup_reg_equiv): Clear defined_p flag for caller save
equivalence.
* lra-constraints.cc (lra_copy_reg_equiv): Add new arg
call_save_p.  Use caller save equivalence depending on the arg.
(split_reg): Adjust the call.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr103541.c: New.

[Bug rtl-optimization/103541] unnecessary spills around const functions calls

2023-02-03 Thread vmakarov at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103541

Vladimir Makarov  changed:

   What|Removed |Added

 CC||vmakarov at gcc dot gnu.org

--- Comment #4 from Vladimir Makarov  ---
Honza, thank you for reporting this.  Fixing just the following code will not
solve the problem as LRA uses only equiv expression valid for the whole
function.

>   ret = valid_combine;
>   if (!MEM_READONLY_P (memref)
>   && !RTL_CONST_OR_PURE_CALL_P (insn))
> return valid_none;
> 

By the way, the old reload pass still works on the test and producing the same
code as LRA currently, also reserving stack slot and using it around the call
instead of reload from a.

I've been working on this problem and I hope the fix will be ready on the next
week.

[Bug rtl-optimization/103541] unnecessary spills around const functions calls

2021-12-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103541

--- Comment #3 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #2)
> PR 5739 is related (though I have not looked fully).

comment #10 which points out IRA was doing worse.

[Bug rtl-optimization/103541] unnecessary spills around const functions calls

2021-12-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103541

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=5739

--- Comment #2 from Andrew Pinski  ---
PR 5739 is related (though I have not looked fully).

[Bug rtl-optimization/103541] unnecessary spills around const functions calls

2021-12-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103541

--- Comment #1 from Andrew Pinski  ---
I thought I had seen this before ...