Bug 59340 - [4.9 Regression] LRA enable-checking bootstrap failure since r205136
Summary: [4.9 Regression] LRA enable-checking bootstrap failure since r205136
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 4.9.0
Assignee: Vladimir Makarov
URL:
Keywords: ice-checking
Depends on:
Blocks:
 
Reported: 2013-11-29 10:55 UTC by Andreas Krebbel
Modified: 2013-12-02 12:14 UTC (History)
2 users (show)

See Also:
Host:
Target: s390x-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Krebbel 2013-11-29 10:55:11 UTC
The following code has been added to s390_decompose_address for the LRA enablement to prevent strict displacement checking for addresses including eliminable registers. Only during LRA execution the displacements are expected to be valid. 

199754   vmakarov       if (lra_in_progress
199754   vmakarov         || (base != arg_pointer_rtx
199754   vmakarov             && indx != arg_pointer_rtx
199754   vmakarov             && base != return_address_pointer_rtx
199754   vmakarov             && indx != return_address_pointer_rtx
199754   vmakarov             && base != frame_pointer_rtx
199754   vmakarov             && indx != frame_pointer_rtx
199754   vmakarov             && base != virtual_stack_vars_rtx
199754   vmakarov             && indx != virtual_stack_vars_rtx))

However, with:

Author: law
Date: Wed Nov 20 18:17:49 2013
New Revision: 205136

URL: http://gcc.gnu.org/viewcvs?rev=205136&root=gcc&view=rev
Log:
    	* lra.c (lra): Set lra_in_progress before check_rtl call.
    	* recog.c (insn_invalid_p): Add !lra_in_progress to prevent
    	adding clobber regs when LRA is running

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lra.c
    trunk/gcc/recog.c


the lra_in_progress = 1; statement has been moved before the initial LRA check_rtl invokation so s390_decompose_address now expects the displacements to be valid already what obviously is not the case.

This leads to a bootstrap failure:

/home/andreas/patched/gcc-head/libgcc/libgcc2.c: In function ‘__mulsc3’:
/home/andreas/patched/gcc-head/libgcc/libgcc2.c:1932:1: error: insn does not satisfy its constraints:
 }
 ^
(insn 21 26 23 2 (set (mem/c:SF (plus:DI (reg/f:DI 34 %fp)
                (const_int -16 [0xfffffffffffffff0])) [2 ac+0 S4 A64])
        (reg:SF 108 [ D.5596 ])) /home/andreas/patched/gcc-head/libgcc/libgcc2.c:1874 88 {movsf}
     (expr_list:REG_DEAD (reg:SF 108 [ D.5596 ])
        (nil)))
/home/andreas/patched/gcc-head/libgcc/libgcc2.c:1932:1: internal compiler error: in check_rtl, at lra.c
:2043

It can easily be reproduced with:

cc1 -O0 t.c
t.c:
void foo (int a) {}
Comment 1 Jakub Jelinek 2013-11-29 14:53:12 UTC
Perhaps we want a different flag for the recog call than lra_in_progress?
Comment 2 Vladimir Makarov 2013-11-29 15:51:41 UTC
(In reply to Jakub Jelinek from comment #1)
> Perhaps we want a different flag for the recog call than lra_in_progress?

Or don't use it all, it is too heavy.  It is better to use something light.  I added this code on early stages of LRA development because it is hard to predict what RTL could be.  Most important check before was one on addresses and it is gone.  Insn_invalid_p check is just a paranoid check.  If something goes wrong, the current LRA catches it later in any case.

I hope to fix it today.
Comment 3 Vladimir Makarov 2013-11-29 20:08:40 UTC
Author: vmakarov
Date: Fri Nov 29 20:08:38 2013
New Revision: 205541

URL: http://gcc.gnu.org/viewcvs?rev=205541&root=gcc&view=rev
Log:
2013-11-29  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/59340
	* lra.c (check_rtl): Use recog_memoized instead of insn_invalid_p.

	Revert
	2013-11-20  Robert Suchanek  <Robert.Suchanek@imgtec.com>

	* lra.c (lra): Set lra_in_progress before check_rtl call.
	* recog.c (insn_invalid_p): Add !lra_in_progress to prevent
	adding clobber regs when LRA is running.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lra.c
    trunk/gcc/recog.c
Comment 4 Vladimir Makarov 2013-11-29 20:18:27 UTC
Andreas, could you check that the bootstrap is fixed.  At least, the test is compiled by the cross-compiler.
Comment 5 Andreas Krebbel 2013-12-02 12:14:31 UTC
Bootstrap works again with r205541. Thanks!