[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-12-20 Thread zhroma at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

Roman Zhuykov  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #12 from Roman Zhuykov  ---
Sorry for mistake in test names (was 92951 instead of 92591).
Obvious rename patch committed as r279645, r279646, r279647 into 10/9/8
branches.

PR is now fixed in all branches.

[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-12-20 Thread zhroma at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

--- Comment #11 from Roman Zhuykov  ---
Author: zhroma
Date: Fri Dec 20 15:07:58 2019
New Revision: 279643

URL: https://gcc.gnu.org/viewcvs?rev=279643&root=gcc&view=rev
Log:
modulo-sched: backport PR92591 fix from mainline

2019-12-20  Roman Zhuykov  

modulo-sched: fix branch rescheduling issue (PR92591)

PR rtl-optimization/92591
* modulo-sched.c (ps_add_node_check_conflicts): Improve checking
for history > 0 case.
* params.def (sms-dfa-history): Limit to 16.

gcc/testsuite:

PR rtl-optimization/92591
* gcc.dg/pr92951-1.c: New test.
* gcc.dg/pr92951-2.c: New test.

Added:
branches/gcc-8-branch/gcc/testsuite/gcc.dg/pr92951-1.c
branches/gcc-8-branch/gcc/testsuite/gcc.dg/pr92951-2.c
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/modulo-sched.c
branches/gcc-8-branch/gcc/params.def
branches/gcc-8-branch/gcc/testsuite/ChangeLog

[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-12-20 Thread zhroma at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

--- Comment #10 from Roman Zhuykov  ---
Author: zhroma
Date: Fri Dec 20 15:05:12 2019
New Revision: 279642

URL: https://gcc.gnu.org/viewcvs?rev=279642&root=gcc&view=rev
Log:
modulo-sched: backport PR92591 fix from mainline

2019-12-20  Roman Zhuykov  

modulo-sched: fix branch rescheduling issue (PR92591)

PR rtl-optimization/92591
* modulo-sched.c (ps_add_node_check_conflicts): Improve checking
for history > 0 case.
* params.def (sms-dfa-history): Limit to 16.

gcc/testsuite:

PR rtl-optimization/92591
* gcc.dg/pr92951-1.c: New test.
* gcc.dg/pr92951-2.c: New test.

Added:
branches/gcc-9-branch/gcc/testsuite/gcc.dg/pr92951-1.c
branches/gcc-9-branch/gcc/testsuite/gcc.dg/pr92951-2.c
Modified:
branches/gcc-9-branch/gcc/ChangeLog
branches/gcc-9-branch/gcc/modulo-sched.c
branches/gcc-9-branch/gcc/params.def
branches/gcc-9-branch/gcc/testsuite/ChangeLog

[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-12-17 Thread zhroma at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

--- Comment #9 from Roman Zhuykov  ---
Started discussion in mailing list:
https://gcc.gnu.org/ml/gcc-patches/2019-12/msg01223.html

[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-12-15 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

--- Comment #8 from Arseny Solokha  ---
Is there a backport pending, or can this PR be closed?

[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-12-13 Thread zhroma at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

--- Comment #7 from Roman Zhuykov  ---
Author: zhroma
Date: Fri Dec 13 17:33:38 2019
New Revision: 279377

URL: https://gcc.gnu.org/viewcvs?rev=279377&root=gcc&view=rev
Log:
modulo-sched: fix branch rescheduling issue (PR92591)

PR rtl-optimization/92591
* modulo-sched.c (ps_add_node_check_conflicts): Improve checking
for history > 0 case.

testsuite:

PR rtl-optimization/92591
* gcc.dg/pr92951-1.c: New test.
* gcc.dg/pr92951-2.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/pr92951-1.c
trunk/gcc/testsuite/gcc.dg/pr92951-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/modulo-sched.c
trunk/gcc/testsuite/ChangeLog

[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-12-04 Thread zhroma at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

--- Comment #6 from Roman Zhuykov  ---
Patches are still testing.  Arm (both 32 and 64 bit) cross compilers are OK,
and I want to test some additional scenarios for powerpc.  Probably I'll post
patches next week.

[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-12-03 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

--- Comment #5 from Arseny Solokha  ---
Roman, are you going to submit these patches to the mailing list?

[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-11-27 Thread zhroma at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

Roman Zhuykov  changed:

   What|Removed |Added

  Attachment #47379|0   |1
is obsolete||

--- Comment #4 from Roman Zhuykov  ---
Created attachment 47386
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47386&action=edit
Proposed patch v2

Found a mistake in previous patch

[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-11-27 Thread zhroma at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

--- Comment #3 from Roman Zhuykov  ---
Created attachment 47380
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47380&action=edit
Parameters patch

[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-11-27 Thread zhroma at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

--- Comment #2 from Roman Zhuykov  ---
Created attachment 47379
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47379&action=edit
Proposed patch

[Bug rtl-optimization/92591] ICE in optimize_sc, at modulo-sched.c:1063

2019-11-27 Thread zhroma at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92591

Roman Zhuykov  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-11-27
   Assignee|unassigned at gcc dot gnu.org  |zhroma at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Roman Zhuykov  ---
Oops, it seems that non-zero sms-dfa-history is untested since modulo-sched was
added in 2004.

This bugs is latent since r177235 in 2011, and logic is similar to bug 84032
comment #4.

When we schedule some insn into row R we check that DFA can't see any conflicts
in rows R-H .. R+H (modulo II), where H=sms-dfa-history.  So, when we schedule
branch into row R some of its neighbours were not yet scheduled and DFA tells
OK.

While scheduling neighbours DFA may check some nearby rows, for example, rows
[R+1-H .. R+1+H] or something like that, but not exactly [R-H .. R+H].  Later
we decide to temporarily remove branch insn from schedule and are pretty sure
we could put it back (if rescheduling to another row fails).  And this time DFA
shows a conflict, because now all branch neighbours are scheduled already.

Attached untested patch fixes this by running extra DFA checks for all rows
[x-H..x+H] where X is any value in range [R-H,R+H], thus eliminating the issue.
Certainly, these checks are expensive enough, so I also prepated a patch about
modulo-sched params, which will set max sms-dfa-history value to 16.  While at
it, the patch also fixes other issues about sms parameters.