[Bug rtl-optimization/64151] [5 Regression] r218266 caused many regressions

2014-12-09 Thread wdijkstr at arm dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64151

--- Comment #7 from Wilco wdijkstr at arm dot com ---
See PR rtl-optimization/64242 for the longjmp issue on i386.


[Bug rtl-optimization/64151] [5 Regression] r218266 caused many regressions

2014-12-03 Thread izamyatin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64151

Igor Zamyatin izamyatin at gmail dot com changed:

   What|Removed |Added

 CC||izamyatin at gmail dot com

--- Comment #4 from Igor Zamyatin izamyatin at gmail dot com ---
I also see ~5% regression on eg spec2006/456.hmmer for i686 with -O3


[Bug rtl-optimization/64151] [5 Regression] r218266 caused many regressions

2014-12-03 Thread hjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64151

--- Comment #5 from hjl at gcc dot gnu.org hjl at gcc dot gnu.org ---
Author: hjl
Date: Wed Dec  3 13:16:25 2014
New Revision: 218312

URL: https://gcc.gnu.org/viewcvs?rev=218312root=gccview=rev
Log:
Revert r218266

gcc/

PR rtl-optimization/64151
PR rtl-optimization/64156
* ira-costs.c (scan_one_insn): Revert r218266.

gcc/testsuite/

PR rtl-optimization/64151
PR rtl-optimization/64156
* gcc.target/aarch64/remat1.c: Removed.  Revert r218267.

Removed:
trunk/gcc/testsuite/gcc.target/aarch64/remat1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ira-costs.c
trunk/gcc/testsuite/ChangeLog


[Bug rtl-optimization/64151] [5 Regression] r218266 caused many regressions

2014-12-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64151

H.J. Lu hjl.tools at gmail dot com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from H.J. Lu hjl.tools at gmail dot com ---
Fixed.


[Bug rtl-optimization/64151] [5 Regression] r218266 caused many regressions

2014-12-02 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64151

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||wrong-code
   Priority|P3  |P1
   Target Milestone|--- |5.0


[Bug rtl-optimization/64151] [5 Regression] r218266 caused many regressions

2014-12-02 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64151

H.J. Lu hjl.tools at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-12-02
 Ever confirmed|0   |1

--- Comment #1 from H.J. Lu hjl.tools at gmail dot com ---
Revert the reg_class change:

diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 72c00cc..16fd6e8 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -1466,7 +1466,7 @@ scan_one_insn (rtx_insn *insn)
  REG_N_SETS (REGNO (SET_DEST (set))) == 1))
general_operand (SET_SRC (set), GET_MODE (SET_SRC (set
 {
-  enum reg_class cl = ALL_REGS;
+  enum reg_class cl = GENERAL_REGS;
   rtx reg = SET_DEST (set);
   int num = COST_INDEX (REGNO (reg));

fixes those regressions.


[Bug rtl-optimization/64151] [5 Regression] r218266 caused many regressions

2014-12-02 Thread wdijkstr at arm dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64151

--- Comment #2 from Wilco wdijkstr at arm dot com ---
(In reply to H.J. Lu from comment #1)
 Revert the reg_class change:
 
 diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
 index 72c00cc..16fd6e8 100644
 --- a/gcc/ira-costs.c
 +++ b/gcc/ira-costs.c
 @@ -1466,7 +1466,7 @@ scan_one_insn (rtx_insn *insn)
   REG_N_SETS (REGNO (SET_DEST (set))) == 1))
 general_operand (SET_SRC (set), GET_MODE (SET_SRC (set
  {
 -  enum reg_class cl = ALL_REGS;
 +  enum reg_class cl = GENERAL_REGS;
rtx reg = SET_DEST (set);
int num = COST_INDEX (REGNO (reg));
 
 fixes those regressions.

Confirmed. The intention of this code is to account for reduced memory cost of
constant loads - when they spill they do not need a store, but can be trivially
rematerialized. What happens is that memory_move_cost returns 100 for certain
cases on x86. With ALL_REGS the mem_cost then becomes very negative as it is
not clamped to zero and this forces the register allocator to spill. This is
bad as __builtin_longjmp on x86 loads EBP/ESP directly via 2 separate
instructions which means reload *may* insert spill code inbetween. So if the
base register is spilled and reloaded via EBP, it corrupts ESP:

movl-4(%ebp), %edx
movl(%edx), %ebp * restore EBP
movl-4(%ebp), %ecx   * oops, this uses a different EBP
movl8(%ecx), %esp
jmp *%eax

I think there are cases where reload just gives up and inserts dumb spill code
(ie. one reload per use), which means this issue can happen under other
circumstances as well.

It appears ALL_REGS works for x86 and avoids the regression, however this is
not correct either for FP or SIMD registers which would get 100 and then get
spilled.


[Bug rtl-optimization/64151] [5 Regression] r218266 caused many regressions

2014-12-02 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64151

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

 CC||trippels at gcc dot gnu.org

--- Comment #3 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
See also PR64156 for the same issue on ppc64.