* [Bug target/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
@ 2012-12-13 11:25 ` rguenth at gcc dot gnu.org
2012-12-13 16:43 ` ubizjak at gmail dot com
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-13 11:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.8.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
2012-12-13 11:25 ` [Bug target/55672] " rguenth at gcc dot gnu.org
@ 2012-12-13 16:43 ` ubizjak at gmail dot com
2012-12-13 16:50 ` ubizjak at gmail dot com
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2012-12-13 16:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
Uros Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-12-13
Ever Confirmed|0 |1
--- Comment #1 from Uros Bizjak <ubizjak at gmail dot com> 2012-12-13 16:43:23 UTC ---
Confirmed, we tried to print "frame" reg from:
(insn 6 3 7 2 (set (reg:CCZ 17 flags)
(compare:CCZ (mem/j/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -32 [0xffffffffffffffe0])) [0 x+0 S4 A32])
(const_int 4 [0x4]))) pr55672.c:4 7 {*cmpsi_1}
(nil))
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
2012-12-13 11:25 ` [Bug target/55672] " rguenth at gcc dot gnu.org
2012-12-13 16:43 ` ubizjak at gmail dot com
@ 2012-12-13 16:50 ` ubizjak at gmail dot com
2012-12-17 10:52 ` jakub at gcc dot gnu.org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2012-12-13 16:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
Uros Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ra
CC| |vmakarov at gcc dot gnu.org
--- Comment #2 from Uros Bizjak <ubizjak at gmail dot com> 2012-12-13 16:49:45 UTC ---
LRA doesn't substitute frame reg with bp. In _.209r.reload, we still have:
(insn 6 3 7 2 (set (reg:CCZ 17 flags)
(compare:CCZ (mem/j/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -32 [0xffffffffffffffe0])) [0 x+0 S4 A32])
(const_int 4 [0x4]))) pr55672.c:4 7 {*cmpsi_1}
(nil))
Adding CC.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
` (2 preceding siblings ...)
2012-12-13 16:50 ` ubizjak at gmail dot com
@ 2012-12-17 10:52 ` jakub at gcc dot gnu.org
2012-12-17 21:39 ` vmakarov at gcc dot gnu.org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-12-17 10:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-12-17 10:51:45 UTC ---
Indeed, with LRA forced off reload replaces the
(insn 6 3 7 2 (set (reg:CCZ 17 flags)
(compare:CCZ (mem/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -32 [0xffffffffffffffe0])) [2 x+0 S4 A32])
(const_int 4 [0x4]))) pr55672.c:4 7 {*cmpsi_1}
(nil))
insn (only reference to frame register) with
(insn 6 3 7 2 (set (reg:CCZ 17 flags)
(compare:CCZ (mem/c:SI (reg/f:SI 7 sp) [2 x+0 S4 A32])
(const_int 4 [0x4]))) pr55672.c:4 7 {*cmpsi_1}
(nil))
while LRA doesn't eliminate it.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
` (3 preceding siblings ...)
2012-12-17 10:52 ` jakub at gcc dot gnu.org
@ 2012-12-17 21:39 ` vmakarov at gcc dot gnu.org
2012-12-18 9:54 ` ubizjak at gmail dot com
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: vmakarov at gcc dot gnu.org @ 2012-12-17 21:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
--- Comment #4 from Vladimir Makarov <vmakarov at gcc dot gnu.org> 2012-12-17 21:39:28 UTC ---
If stack_realign_p is true, frame_pointer_needed is also true. So we can use
fp to eliminate frame but i386.c::x86_can_eliminate prohibits it. The code
looks strange:
if (stack_realign_fp)
return ((from == ARG_POINTER_REGNUM
&& to == HARD_FRAME_POINTER_REGNUM)
|| (from == FRAME_POINTER_REGNUM
&& to == STACK_POINTER_REGNUM));
So we permit to change argument pointer but not frame pointer to FP which again
is strange IMHO. Changing the code to
if (stack_realign_fp)
return ((from == ARG_POINTER_REGNUM
&& to == HARD_FRAME_POINTER_REGNUM)
|| (from == FRAME_POINTER_REGNUM
&& to == STACK_POINTER_REGNUM)
|| (from == FRAME_POINTER_REGNUM
&& to == HARD_FRAME_POINTER_REGNUM));
solves the problem.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
` (4 preceding siblings ...)
2012-12-17 21:39 ` vmakarov at gcc dot gnu.org
@ 2012-12-18 9:54 ` ubizjak at gmail dot com
2012-12-18 15:12 ` hjl.tools at gmail dot com
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2012-12-18 9:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
Uros Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hjl.tools at gmail dot com
--- Comment #5 from Uros Bizjak <ubizjak at gmail dot com> 2012-12-18 09:54:17 UTC ---
CC author of stack realignment functionality.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
` (5 preceding siblings ...)
2012-12-18 9:54 ` ubizjak at gmail dot com
@ 2012-12-18 15:12 ` hjl.tools at gmail dot com
2012-12-18 19:43 ` hjl.tools at gmail dot com
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: hjl.tools at gmail dot com @ 2012-12-18 15:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> 2012-12-18 15:11:38 UTC ---
This is what we changed in reload for stack realignment:
diff --git a/gcc/reload1.c b/gcc/reload1.c
index f28b01c..9b81062 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -3663,8 +3663,11 @@ update_eliminables (HARD_REG_SET *pset)
frame_pointer_needed = 1;
for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++)
{
- if (ep->can_eliminate && ep->from == FRAME_POINTER_REGNUM
- && ep->to != HARD_FRAME_POINTER_REGNUM)
+ if (ep->can_eliminate
+ && ep->from == FRAME_POINTER_REGNUM
+ && ep->to != HARD_FRAME_POINTER_REGNUM
+ && (! SUPPORTS_STACK_ALIGNMENT
+ || ! crtl->stack_realign_needed))
frame_pointer_needed = 0;
if (! ep->can_eliminate && ep->can_eliminate_previous)
@@ -3720,7 +3723,10 @@ init_elim_table (void)
ep->to = ep1->to;
ep->can_eliminate = ep->can_eliminate_previous
= (CAN_ELIMINATE (ep->from, ep->to)
- && ! (ep->to == STACK_POINTER_REGNUM && frame_pointer_needed));
+ && ! (ep->to == STACK_POINTER_REGNUM
+ && frame_pointer_needed
+ && (! SUPPORTS_STACK_ALIGNMENT
+ || ! stack_realign_fp)));
}
#else
reg_eliminate[0].from = reg_eliminate_1[0].from;
LRA should have similar codes.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
` (6 preceding siblings ...)
2012-12-18 15:12 ` hjl.tools at gmail dot com
@ 2012-12-18 19:43 ` hjl.tools at gmail dot com
2012-12-18 20:35 ` [Bug rtl-optimization/55672] " hjl.tools at gmail dot com
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: hjl.tools at gmail dot com @ 2012-12-18 19:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> 2012-12-18 19:42:59 UTC ---
LRA doesn't handle HARD_FRAME_POINTER_IS_FRAME_POINTER at all.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
` (7 preceding siblings ...)
2012-12-18 19:43 ` hjl.tools at gmail dot com
@ 2012-12-18 20:35 ` hjl.tools at gmail dot com
2012-12-21 21:29 ` vmakarov at gcc dot gnu.org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: hjl.tools at gmail dot com @ 2012-12-18 20:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|target |rtl-optimization
--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> 2012-12-18 20:35:17 UTC ---
(In reply to comment #4)
> If stack_realign_p is true, frame_pointer_needed is also true. So we can use
> fp to eliminate frame but i386.c::x86_can_eliminate prohibits it. The code
> looks strange:
>
>
> if (stack_realign_fp)
> return ((from == ARG_POINTER_REGNUM
> && to == HARD_FRAME_POINTER_REGNUM)
> || (from == FRAME_POINTER_REGNUM
> && to == STACK_POINTER_REGNUM));
>
> So we permit to change argument pointer but not frame pointer to FP which again
> is strange IMHO. Changing the code to
>
> if (stack_realign_fp)
> return ((from == ARG_POINTER_REGNUM
> && to == HARD_FRAME_POINTER_REGNUM)
> || (from == FRAME_POINTER_REGNUM
> && to == STACK_POINTER_REGNUM)
> || (from == FRAME_POINTER_REGNUM
> && to == HARD_FRAME_POINTER_REGNUM));
>
> solves the problem.
It fixes ICE, but generates questionable code:
main:
.LFB0:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
andl $-16, %esp
subl $8236, %esp
orl $0, (%esp)
addl $8204, %esp
cmpl $4, -40(%ebp)
je .L2
call abort
.L2:
movl $0, %eax
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
Without LRA, we got
main:
.LFB0:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
andl $-16, %esp
subl $8236, %esp
orl $0, (%esp)
addl $8204, %esp
cmpl $4, (%esp)
je .L2
call abort
.L2:
movl $0, %eax
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
The difference is
--- x.s 2012-12-18 12:24:17.072888139 -0800
+++ no-lra.s 2012-12-18 12:30:11.419157548 -0800
@@ -14,7 +14,7 @@ main:
subl $8236, %esp
orl $0, (%esp)
addl $8204, %esp
- cmpl $4, -40(%ebp)
+ cmpl $4, (%esp)
je .L2
call abort
.L2:
I think LRA generated code is wrong. The reason we don't allow
converting software frame pointer to hardware frame pointer is
when stack alignment is needed, hardware frame pointer is used
to save stack pointer. We can no longer use it for software
frame pointer.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
` (8 preceding siblings ...)
2012-12-18 20:35 ` [Bug rtl-optimization/55672] " hjl.tools at gmail dot com
@ 2012-12-21 21:29 ` vmakarov at gcc dot gnu.org
2013-01-07 15:30 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: vmakarov at gcc dot gnu.org @ 2012-12-21 21:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
--- Comment #9 from Vladimir Makarov <vmakarov at gcc dot gnu.org> 2012-12-21 21:28:51 UTC ---
(In reply to comment #8)
>
> The difference is
>
> --- x.s 2012-12-18 12:24:17.072888139 -0800
> +++ no-lra.s 2012-12-18 12:30:11.419157548 -0800
> @@ -14,7 +14,7 @@ main:
> subl $8236, %esp
> orl $0, (%esp)
> addl $8204, %esp
> - cmpl $4, -40(%ebp)
> + cmpl $4, (%esp)
> je .L2
> call abort
> .L2:
>
> I think LRA generated code is wrong. The reason we don't allow
> converting software frame pointer to hardware frame pointer is
> when stack alignment is needed, hardware frame pointer is used
> to save stack pointer. We can no longer use it for software
> frame pointer.
H.J., thanks for the explanation. Now I know what to do. I'll start to work
on the solution after my vacation in 2 weeks.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
` (9 preceding siblings ...)
2012-12-21 21:29 ` vmakarov at gcc dot gnu.org
@ 2013-01-07 15:30 ` rguenth at gcc dot gnu.org
2013-01-10 20:24 ` ubizjak at gmail dot com
2013-01-11 10:45 ` jakub at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-01-07 15:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
` (10 preceding siblings ...)
2013-01-07 15:30 ` rguenth at gcc dot gnu.org
@ 2013-01-10 20:24 ` ubizjak at gmail dot com
2013-01-11 10:45 ` jakub at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2013-01-10 20:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
--- Comment #10 from Uros Bizjak <ubizjak at gmail dot com> 2013-01-10 20:23:49 UTC ---
Author: vmakarov
Date: Thu Jan 10 20:07:55 2013
New Revision: 195095
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195095
Log:
2013-01-10 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/pr55672
* lra-eliminations.c (mark_not_elimnable): Permit addition with
const to be elimnable.
2013-01-10 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/pr55672
* gcc.target/i386/pr55672.c: New.
Added:
trunk/gcc/testsuite/gcc.target/i386/pr55672.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/lra-eliminations.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/55672] [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868
2012-12-13 11:25 [Bug target/55672] New: [4.8 Regression] -fstack-check=generic ICEs in print_reg, at config/i386/i386.c:13868 rguenth at gcc dot gnu.org
` (11 preceding siblings ...)
2013-01-10 20:24 ` ubizjak at gmail dot com
@ 2013-01-11 10:45 ` jakub at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-11 10:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-11 10:44:34 UTC ---
Assuming fixed.
^ permalink raw reply [flat|nested] 14+ messages in thread