public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64
@ 2014-11-17  3:22 pinskia at gcc dot gnu.org
  2014-11-17  3:22 ` [Bug rtl-optimization/63906] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-17  3:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906

            Bug ID: 63906
           Summary: [5 Regression] lra_remat mis-compiles glibc on aarch64
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
            Target: aarch64-linux-gnu

I don't have much information yet but I wanted to file this so I don't lose
track of it.

With lra_remat turned on, we get a crash inside dl_main.

   0x000000400080386c <dl_main+5604>:   ldr     x2, [x3,w0,uxtw #3]
=> 0x0000004000803870 <dl_main+5608>:   ldrb    w1, [x2,#788]
(gdb) p $x2
$1 = 0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/63906] [5 Regression] lra_remat mis-compiles glibc on aarch64
  2014-11-17  3:22 [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64 pinskia at gcc dot gnu.org
@ 2014-11-17  3:22 ` pinskia at gcc dot gnu.org
  2014-11-17  3:53 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-17  3:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
   Target Milestone|---                         |5.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/63906] [5 Regression] lra_remat mis-compiles glibc on aarch64
  2014-11-17  3:22 [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64 pinskia at gcc dot gnu.org
  2014-11-17  3:22 ` [Bug rtl-optimization/63906] " pinskia at gcc dot gnu.org
@ 2014-11-17  3:53 ` pinskia at gcc dot gnu.org
  2014-11-17  3:54 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-17  3:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
dl-deps.c is being miscompiled.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/63906] [5 Regression] lra_remat mis-compiles glibc on aarch64
  2014-11-17  3:22 [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64 pinskia at gcc dot gnu.org
  2014-11-17  3:22 ` [Bug rtl-optimization/63906] " pinskia at gcc dot gnu.org
  2014-11-17  3:53 ` pinskia at gcc dot gnu.org
@ 2014-11-17  3:54 ` pinskia at gcc dot gnu.org
  2014-11-17  4:46 ` [Bug rtl-optimization/63906] [5 Regression] dse after reload miscompiles glibc with lra_remat turned " pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-17  3:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> dl-deps.c is being miscompiled.

Specifically _dl_map_object_deps.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/63906] [5 Regression] dse after reload miscompiles glibc with lra_remat turned on aarch64
  2014-11-17  3:22 [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64 pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-11-17  3:54 ` pinskia at gcc dot gnu.org
@ 2014-11-17  4:46 ` pinskia at gcc dot gnu.org
  2014-11-17  4:47 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-17  4:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[5 Regression] lra_remat    |[5 Regression] dse after
                   |mis-compiles glibc on       |reload miscompiles glibc
                   |aarch64                     |with lra_remat turned on
                   |                            |aarch64

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It looks like dse is removing more stores when lra_remat is enable:

(insn 538 537 2663 41 (set (mem/f:DI (plus:DI (reg/f:DI 1 x1 [581])
                (const_int 16 [0x10])) [1 runp_409->next+0 S8 A128])
        (const_int 0 [0])) dl-deps.c:283 42 {*movdi_aarch64}
     (nil))


That is for:
            newp->next = NULL;
            tail->next = newp;

DSE (after reload) thinks tail->next is the same as the store to newp->next
with LRA_REMAT turned on.
**scanning insn=538
  mem: (plus:DI (reg/f:DI 1 x1 [581])
    (const_int 16 [0x10]))

   after canon_rtx address: (plus:DI (reg/f:DI 1 x1 [581])
    (const_int 16 [0x10]))

   after cselib_expand address: (plus:DI (reg/f:DI 31 sp)
    (const_int 16 [0x10]))
....
**scanning insn=539
  mem: (plus:DI (reg/v/f:DI 2 x2 [orig:88 runp ] [88])
    (const_int 16 [0x10]))

   after canon_rtx address: (plus:DI (reg/v/f:DI 2 x2 [orig:88 runp ] [88])
    (const_int 16 [0x10]))

   after cselib_expand address: (plus:DI (reg/f:DI 31 sp)
    (const_int 16 [0x10]))

   after canon_rtx address: (plus:DI (reg/f:DI 31 sp)
    (const_int 16 [0x10]))
  varying cselib base=2:4287 offset = 16
 processing cselib store [16..24)
**scanning insn=539
  mem: (plus:DI (reg/v/f:DI 2 x2 [orig:88 runp ] [88])
    (const_int 16 [0x10]))

   after canon_rtx address: (plus:DI (reg/v/f:DI 2 x2 [orig:88 runp ] [88])
    (const_int 16 [0x10]))

   after cselib_expand address: (plus:DI (reg/f:DI 31 sp)
    (const_int 16 [0x10]))

   after canon_rtx address: (plus:DI (reg/f:DI 31 sp)
    (const_int 16 [0x10]))
  varying cselib base=2:4287 offset = 16
 processing cselib store [16..24)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/63906] [5 Regression] dse after reload miscompiles glibc with lra_remat turned on aarch64
  2014-11-17  3:22 [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64 pinskia at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-11-17  4:46 ` [Bug rtl-optimization/63906] [5 Regression] dse after reload miscompiles glibc with lra_remat turned " pinskia at gcc dot gnu.org
@ 2014-11-17  4:47 ` pinskia at gcc dot gnu.org
  2014-11-17  5:01 ` [Bug rtl-optimization/63906] [5 Regression] lra_remat miscompiles glibc " pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-17  4:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 33996
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33996&action=edit
the .i file


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/63906] [5 Regression] lra_remat miscompiles glibc on aarch64
  2014-11-17  3:22 [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64 pinskia at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-11-17  4:47 ` pinskia at gcc dot gnu.org
@ 2014-11-17  5:01 ` pinskia at gcc dot gnu.org
  2014-11-17  9:19 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-17  5:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vmakarov at gcc dot gnu.org
            Summary|[5 Regression] dse after    |[5 Regression] lra_remat
                   |reload miscompiles glibc    |miscompiles glibc on
                   |with lra_remat turned on    |aarch64
                   |aarch64                     |

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
No the problem is LRA_REMAT thinks:
(insn 2653 217 219 13 (set (reg/v/f:DI 3 x3 [orig:97 needed ] [97])
        (mem/c:DI (plus:DI (reg/f:DI 29 x29)
                (const_int 152 [0x98])) [34 %sfp+-136 S8 A64])) dl-deps.c:224
42 {*movdi_aarch64}
     (nil))

Is really sp but it is not as sp has changed just a few instructions above:
(insn 210 2652 214 13 (set (reg/f:DI 31 sp)
        (minus:DI (reg/f:DI 3 x3 [1110])
            (reg:DI 1 x1 [485]))) dl-deps.c:224 218 {subdi3}
     (nil))

Meaning LRA_remat cannot think sp is a constant if alloca is ever used.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/63906] [5 Regression] lra_remat miscompiles glibc on aarch64
  2014-11-17  3:22 [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64 pinskia at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-11-17  5:01 ` [Bug rtl-optimization/63906] [5 Regression] lra_remat miscompiles glibc " pinskia at gcc dot gnu.org
@ 2014-11-17  9:19 ` rguenth at gcc dot gnu.org
  2014-11-17 20:30 ` vmakarov at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-17  9:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/63906] [5 Regression] lra_remat miscompiles glibc on aarch64
  2014-11-17  3:22 [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64 pinskia at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2014-11-17  9:19 ` rguenth at gcc dot gnu.org
@ 2014-11-17 20:30 ` vmakarov at gcc dot gnu.org
  2014-11-18  0:15 ` vmakarov at gcc dot gnu.org
  2014-11-18  3:23 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: vmakarov at gcc dot gnu.org @ 2014-11-17 20:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906

--- Comment #6 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> Created attachment 33996 [details]
> the .i file

Andrew, I'll start to work on this soon.  Sorry for inconvenience introduced by
LRA remat. pass.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/63906] [5 Regression] lra_remat miscompiles glibc on aarch64
  2014-11-17  3:22 [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64 pinskia at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2014-11-17 20:30 ` vmakarov at gcc dot gnu.org
@ 2014-11-18  0:15 ` vmakarov at gcc dot gnu.org
  2014-11-18  3:23 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: vmakarov at gcc dot gnu.org @ 2014-11-18  0:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906

--- Comment #7 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
Author: vmakarov
Date: Tue Nov 18 00:14:25 2014
New Revision: 217683

URL: https://gcc.gnu.org/viewcvs?rev=217683&root=gcc&view=rev
Log:
2014-11-17  Vladimir Makarov  <vmakarov@redhat.com>

    PR rtl-optimization/63906
    * lra-remat.c (operand_to_remat): Check SP and
    frame_pointer_required.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lra-remat.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/63906] [5 Regression] lra_remat miscompiles glibc on aarch64
  2014-11-17  3:22 [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64 pinskia at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2014-11-18  0:15 ` vmakarov at gcc dot gnu.org
@ 2014-11-18  3:23 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-18  3:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed fixed.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-11-18  3:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-17  3:22 [Bug rtl-optimization/63906] New: [5 Regression] lra_remat mis-compiles glibc on aarch64 pinskia at gcc dot gnu.org
2014-11-17  3:22 ` [Bug rtl-optimization/63906] " pinskia at gcc dot gnu.org
2014-11-17  3:53 ` pinskia at gcc dot gnu.org
2014-11-17  3:54 ` pinskia at gcc dot gnu.org
2014-11-17  4:46 ` [Bug rtl-optimization/63906] [5 Regression] dse after reload miscompiles glibc with lra_remat turned " pinskia at gcc dot gnu.org
2014-11-17  4:47 ` pinskia at gcc dot gnu.org
2014-11-17  5:01 ` [Bug rtl-optimization/63906] [5 Regression] lra_remat miscompiles glibc " pinskia at gcc dot gnu.org
2014-11-17  9:19 ` rguenth at gcc dot gnu.org
2014-11-17 20:30 ` vmakarov at gcc dot gnu.org
2014-11-18  0:15 ` vmakarov at gcc dot gnu.org
2014-11-18  3:23 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).