[Bug rtl-optimization/70023] New: [4.9/5/6 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fno-sched-critical-path-heuristic -fschedule-insns -m8bit-idiv

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] New: [4.9/5/6 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fno-sched-critical-path-heuristic -fschedule-insns -m8bit-idiv

msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

            Bug ID: 70023
           Summary: [4.9/5/6 Regression] ICE: in assign_by_spills, at
                    lra-assigns.c:1417 with
                    -fno-sched-critical-path-heuristic -fschedule-insns
                    -m8bit-idiv
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
            Target: x86_64-pc-linux-gnu

Created attachment 37828
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37828&action=edit
reduced testcase

Compiler output:
$ gcc -O -fno-sched-critical-path-heuristic -fschedule-insns -m8bit-idiv
testcase2.c
testcase2.c: In function 'foo':
testcase2.c:5:1: note: The ABI for passing parameters with 32-byte alignment
has changed in GCC 4.6
 foo(int u16_0, int u64_0, i128 u128_0, i128 u128_1, v8si v32u32_0, v8si
v32u32_1, v8si v32u64_1)
 ^~~
testcase2.c:5:1: warning: AVX vector argument without AVX enabled changes the
ABI [-Wpsabi]
testcase2.c:12:1: error: unable to find a register to spill
 }
 ^
testcase2.c:12:1: error: this is the insn:
(insn 10 96 94 2 (parallel [
            (set (mem/j/c:SI (plus:DI (reg/f:DI 16 argp)
                        (const_int 32 [0x20])) [1 v32u32_0+24 S4 A64])
                (ashift:SI (mem/j/c:SI (plus:DI (reg/f:DI 16 argp)
                            (const_int 32 [0x20])) [1 v32u32_0+24 S4 A64])
                    (subreg:QI (and:SI (reg:SI 154)
                            (const_int 31 [0x1f])) 0)))
            (clobber (reg:CC 17 flags))
        ]) testcase2.c:7 525 {*ashlsi3_mask}
     (expr_list:REG_DEAD (reg:SI 154)
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))
testcase2.c:12:1: internal compiler error: in assign_by_spills, at
lra-assigns.c:1417
0xb395b8 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        /repo/gcc-trunk/gcc/rtl-error.c:108
0xa04e96 assign_by_spills
        /repo/gcc-trunk/gcc/lra-assigns.c:1417
0xa055a3 lra_assign()
        /repo/gcc-trunk/gcc/lra-assigns.c:1590
0xa0096f lra(_IO_FILE*)
        /repo/gcc-trunk/gcc/lra.c:2331
0x9a7189 do_reload
        /repo/gcc-trunk/gcc/ira.c:5396
0x9a7189 execute
        /repo/gcc-trunk/gcc/ira.c:5567
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:

Tested revisions:
trunk r233801 - FAIL
5-branch r233800 - FAIL
4_9-branch r233802 - FAIL
4_8-branch r224828 - FAIL
4_7-branch r211571 - OK
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [4.9/5/6 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fno-sched-critical-path-heuristic -fschedule-insns -m8bit-idiv

msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-03-01
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |4.9.4
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started most likely with r197308.
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [4.9/5/6 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fno-sched-critical-path-heuristic -fschedule-insns -m8bit-idiv

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
      Known to work|                            |4.7.4
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [4.9/5/6 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fno-sched-critical-path-heuristic -fschedule-insns -m8bit-idiv

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ra

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
Actually, this is known issue with instructions that have single-reg
constraint. Register allocator has no fixup for cases when needed hard reg is
already allocated and live accros the insn.

We have a couple of similar PRs, which unfortunatelly won't be fixed for gcc-6.

(The mentioned revision just slightly changes register allocations to trigger
the issue mentioned above. But without some added RA functionality that would
resolve the allocation conflict, we are out of luck).
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [4.9/5/6 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fno-sched-critical-path-heuristic -fschedule-insns -m8bit-idiv

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at redhat dot com

--- Comment #3 from Jeffrey A. Law <law at redhat dot com> ---
In the past we've not supported the first instruction scheduling pass on the
x86 because of the problems with extension of hard register lifetimes.

Is that still the case?  If so, what's the mechanism by which that happens
these days (I didn't see if with some quick scanning).
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [4.9/5/6 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fno-sched-critical-path-heuristic -fschedule-insns -m8bit-idiv

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ysrumyan at gmail dot com

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Jeffrey A. Law from comment #3)
> In the past we've not supported the first instruction scheduling pass on the
> x86 because of the problems with extension of hard register lifetimes.
>
> Is that still the case?  If so, what's the mechanism by which that happens
> these days (I didn't see if with some quick scanning).

The target-dependent scheduling fixups are based on work by Yuri Rumyantsev
(CCd) from 2012, e.g.:

2012-10-04  Yuri Rumyantsev  <[hidden email]>

        * config/i386/i386.c (ix86_dep_by_shift_count_body) : Add
        check on reload_completed since it can be invoked before
        register allocation phase in pre-reload schedule.
        (ia32_multipass_dfa_lookahead) : Do not use dfa_lookahead for
        pre-reload schedule to save compile time.
        (ix86_sched_reorder) : Do not perform ready list reordering for
        pre-reload schedule to save compile time.
        (insn_is_function_arg) : New function. Returns true if lhs of insn is
        HW function argument register.
        (add_parameter_dependencies) : New function. Add output dependencies
        for chain of function adjacent arguments if only there is a move to
        likely spilled HW registers. Return first argument if at least one
        dependence was added or NULL otherwise.
        (avoid_func_arg_motion) : New function. Add output or anti dependency
        from insn to first_arg to restrict code motion.
        (add_dependee_for_func_arg) : New function. Avoid cross block motion of
        function argument through adding dependency from the first non-jump
        insn in bb.
        (ix86_dependencies_evaluation_hook) : New function. Hook for
        pre-reload schedule: avoid motion of function arguments passed in
        likely spilled HW registers.
        (ix86_adjust_priority) : New function. Hook for pre-reload schedule:
        set priority of moves from likely spilled HW registers to maximum to
        schedule them as soon as possible.
        (ix86_sched_init_global): Do not perform multipass scheduling for
        pre-reload schedule to save compile time.

which introduced several scheduling helpers that try to rearrange insns to
decrease probability of running into spill failures. While these fixups and
some later RA significantly reduced spill failures, there are still some cases
(like the one in this PR), where allocation fails with severely constrainted
instructions.
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [4.9/5/6 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fno-sched-critical-path-heuristic -fschedule-insns -m8bit-idiv

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

--- Comment #5 from Uroš Bizjak <ubizjak at gmail dot com> ---
*** Bug 70374 has been marked as a duplicate of this bug. ***
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [4.9/5/6 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fno-sched-critical-path-heuristic -fschedule-insns -m8bit-idiv

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |helloqirun at gmail dot com

--- Comment #6 from Uroš Bizjak <ubizjak at gmail dot com> ---
*** Bug 69773 has been marked as a duplicate of this bug. ***
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [4.9/5/6 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fschedule-insns

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

--- Comment #7 from Qirun Zhang <helloqirun at gmail dot com> ---
(In reply to Uroš Bizjak from comment #6)
> *** Bug 69773 has been marked as a duplicate of this bug. ***

PR69773 was reported and confirmed more than one month ago. The two bugs share
the same stack trace. IMHO, it should not be a duplicate.
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [4.9/5/6 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fschedule-insns

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Qirun Zhang from comment #7)
> (In reply to Uroš Bizjak from comment #6)
> > *** Bug 69773 has been marked as a duplicate of this bug. ***
>
> PR69773 was reported and confirmed more than one month ago. The two bugs
> share the same stack trace. IMHO, it should not be a duplicate.

Please read Comment #2. The insn is different, but the problem is the same.
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [4.9/5/6/7 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417 with -fschedule-insns

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.4                       |5.5

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 4.9 branch is being closed
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [5/6/7/8 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417/8 with -fschedule-insns

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.5                         |6.5

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 5 branch is being closed
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [6/7/8 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417/8 with -fschedule-insns

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |7.3.0, 8.0

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Still ICEs with current trunk.
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [6/7/8 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417/8 with -fschedule-insns

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

--- Comment #12 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #11)
> Still ICEs with current trunk.

LRA has a hard reg splitting.  It was absent in reload.  It decreased the
number of 'unable to find a register to spill' failures.  Unfortunately, it
works when there is only one alternative with small register class.

In this case *ashlsi3_mask has a few alternatives and only one alternative is
small register class and the current LRA can not do anything.

It is very hard to fix the problem (especially without performance change for
other cases).  As there are too many such PRs, I should make it my high
priority bug.  I'll work on it.  May be in a week I'll have an acceptable fix.
It is very hard to say for me about the outcome of my work.
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [6/7/8 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417/8 with -fschedule-insns

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

--- Comment #13 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
Author: vmakarov
Date: Fri Feb 16 18:17:09 2018
New Revision: 257751

URL: https://gcc.gnu.org/viewcvs?rev=257751&root=gcc&view=rev
Log:
2018-02-16  Vladimir Makarov  <[hidden email]>

        PR rtl-optimization/70023
        * lra-constraints.c (inherit_in_ebb): Take hard reg mode of
        src_regno into account.

2018-02-16  Vladimir Makarov  <[hidden email]>

        PR rtl-optimization/70023
        * gcc.target/i386/pr70023.c: New.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr70023.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lra-constraints.c
    trunk/gcc/testsuite/ChangeLog
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [6/7 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417/8 with -fschedule-insns

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|6.5                         |7.4

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 6 branch is being closed
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [7 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417/8 with -fschedule-insns

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.4                         |7.5
Reply | Threaded
Open this post in threaded view
|

[Bug rtl-optimization/70023] [7 Regression] ICE: in assign_by_spills, at lra-assigns.c:1417/8 with -fschedule-insns

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70023

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |8.0
         Resolution|---                         |FIXED
   Target Milestone|7.5                         |8.0
      Known to fail|8.0                         |7.5.0

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 8.