public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/57518] New: Redundent insn generated in LRA
@ 2013-06-03 21:04 wmi at google dot com
  2013-06-12 21:47 ` [Bug rtl-optimization/57518] [4.8/4.9 Regression] Redundant " wmi at google dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: wmi at google dot com @ 2013-06-03 21:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57518

            Bug ID: 57518
           Summary: Redundent insn generated in LRA
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wmi at google dot com

Testcase:

char ip[10];
int total, total1;

void foo() {
  int t;

  t = ip[2];
  total = t & 0x3;
}

Target: x86_64-linux-gnu
gcc version 4.9.0 20130529 (experimental) (GCC) 
~/workarea/gcc-r199418/build/install/bin/gcc -O2 -S 1.c
        .cfi_startproc
        movzbl  ip+2(%rip), %eax
        movb    %al, -16(%rsp)     ==> redundent
        movl    -16(%rsp), %eax    ==> redundent
        andl    $3, %eax
        movl    %eax, total(%rip)
        ret
        .cfi_endproc


Target: x86_64-linux-gnu
gcc version 4.8.0 20120613 (experimental) (GCC)
gcc -O2 -S 1.c
    .cfi_startproc
    movzbl    ip+2(%rip), %eax
    andl    $3, %eax
    movl    %eax, total(%rip)
    ret
    .cfi_endproc



IR before LRA:

(insn 12 7 8 2 (set (reg:QI 64 [ ip+2 ])
        (mem/j/c:QI (const:DI (plus:DI (symbol_ref:DI ("ip")  <var_decl
0x7ffff61da260 ip>)
                    (const_int 2 [0x2]))) [0 ip+2 S1 A8])) 1.c:9 87
{*movqi_internal}
     (expr_list:REG_EQUIV (mem/j/c:QI (const:DI (plus:DI (symbol_ref:DI ("ip") 
<var_decl 0x7ffff61da260 ip>)
                    (const_int 2 [0x2]))) [0 ip+2 S1 A8])
        (nil)))
(insn 8 12 9 2 (parallel [
            (set (reg:SI 65 [ D.1731 ])
                (and:SI (subreg:SI (reg:QI 64 [ ip+2 ]) 0)
                    (const_int 3 [0x3])))
            (clobber (reg:CC 17 flags))
        ]) 1.c:9 387 {*andsi_1}
     (expr_list:REG_DEAD (reg:QI 64 [ ip+2 ])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (expr_list:REG_EQUIV (mem/c:SI (symbol_ref:DI ("total")  <var_decl
0x7ffff61da2f8 total>) [2 total+0 S4 A32])
                (nil)))))

IR after LRA:

(insn 12 7 14 2 (set (reg:QI 0 ax [orig:64 ip+2 ] [64])
        (mem/j/c:QI (const:DI (plus:DI (symbol_ref:DI ("ip")  <var_decl
0x7ffff61da260 ip>)
                    (const_int 2 [0x2]))) [0 ip+2 S1 A8])) 1.c:9 87
{*movqi_internal}
     (expr_list:REG_EQUIV (mem/j/c:QI (const:DI (plus:DI (symbol_ref:DI ("ip") 
<var_decl 0x7ffff61da260 ip>)
                    (const_int 2 [0x2]))) [0 ip+2 S1 A8])
        (nil)))
(insn 14 12 15 2 (set (mem/c:QI (plus:DI (reg/f:DI 7 sp)
                (const_int -16 [0xfffffffffffffff0])) [3 %sfp+-16 S1 A64])
        (reg:QI 0 ax [orig:64 ip+2 ] [64])) 1.c:9 87 {*movqi_internal}
     (expr_list:REG_DEAD (reg:QI 0 ax [orig:64 ip+2 ] [64])
        (nil)))
(insn 15 14 8 2 (set (reg:SI 0 ax [orig:65 D.1731 ] [65])
        (mem/c:SI (plus:DI (reg/f:DI 7 sp)
                (const_int -16 [0xfffffffffffffff0])) [3 %sfp+-16 S4 A64]))
1.c:9 85 {*movsi_internal}
     (nil))
(insn 8 15 16 2 (parallel [
            (set (reg:SI 0 ax [orig:65 D.1731 ] [65])
                (and:SI (reg:SI 0 ax [orig:65 D.1731 ] [65])
                    (const_int 3 [0x3])))
            (clobber (reg:CC 17 flags))
        ]) 1.c:9 387 {*andsi_1}
     (expr_list:REG_EQUIV (mem/c:SI (symbol_ref:DI ("total")  <var_decl
0x7ffff61da2f8 total>) [2 total+0 S4 A32])
        (nil)))

IRA Trace:

Pass 0 for finding pseudo/allocno costs

    a0 (r65,l0) best GENERAL_REGS, allocno GENERAL_REGS
    a1 (r64,l0) best NO_REGS, allocno NO_REGS

a1's rclass are all NO_REGS because it has REG_EQUIV note (equivalent to mem
ip+2)

Because reg 64 is marked as equivalent to mem ip+2, insn 12 is expected to be
deleted and reg 64 in insn 8 replaced by mem ip+2. In LRA constraints, insn 12
is not deleted because the subreg op in insn 8 (see lra-constraints.c:3662
r199418). In addition, reg 64's rclass is NO_REGS, so redundent spills are
inserted. 

The mode size check (lra-constraints.c:3662 r199418) needs to be considered in
update_equiv_regs in IRA, in order not to mark the reg 64 equivalent with mem
ip + 2 in this case.


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

* [Bug rtl-optimization/57518] [4.8/4.9 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
@ 2013-06-12 21:47 ` wmi at google dot com
  2013-06-20  8:56 ` [Bug rtl-optimization/57518] [4.9 " rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: wmi at google dot com @ 2013-06-12 21:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57518

--- Comment #1 from wmi at google dot com ---
post a candidate patch here:

http://gcc.gnu.org/ml/gcc-patches/2013-06/msg00748.html


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

* [Bug rtl-optimization/57518] [4.9 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
  2013-06-12 21:47 ` [Bug rtl-optimization/57518] [4.8/4.9 Regression] Redundant " wmi at google dot com
@ 2013-06-20  8:56 ` rguenth at gcc dot gnu.org
  2013-06-20 15:55 ` wmi at google dot com
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-06-20  8:56 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57518

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.0
            Summary|[4.8/4.9 Regression]        |[4.9 Regression] Redundant
                   |Redundant insn generated in |insn generated in LRA
                   |LRA                         |

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
>From the description I gather that 4.8.0 works.


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

* [Bug rtl-optimization/57518] [4.9 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
  2013-06-12 21:47 ` [Bug rtl-optimization/57518] [4.8/4.9 Regression] Redundant " wmi at google dot com
  2013-06-20  8:56 ` [Bug rtl-optimization/57518] [4.9 " rguenth at gcc dot gnu.org
@ 2013-06-20 15:55 ` wmi at google dot com
  2013-06-24 10:20 ` [Bug rtl-optimization/57518] [4.8/4.9 " rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: wmi at google dot com @ 2013-06-20 15:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57518

wmi at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #3 from wmi at google dot com ---
oh, sorry to make it misleading, but the 4.8.0 below is an experimental version
(see its date is 20120613, at that time LRA has not been merged):

Target: x86_64-linux-gnu
gcc version 4.8.0 20120613 (experimental) (GCC)
gcc -O2 -S 1.c
    .cfi_startproc
    movzbl    ip+2(%rip), %eax
    andl    $3, %eax
    movl    %eax, total(%rip)
    ret
    .cfi_endproc

I just verified using 4.8.0 and 4.8.1 releases, the problem was there for both.


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

* [Bug rtl-optimization/57518] [4.8/4.9 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
                   ` (2 preceding siblings ...)
  2013-06-20 15:55 ` wmi at google dot com
@ 2013-06-24 10:20 ` rguenth at gcc dot gnu.org
  2013-10-12  0:25 ` brooks at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-06-24 10:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57518

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.0                       |4.8.2
            Summary|[4.9 Regression] Redundant  |[4.8/4.9 Regression]
                   |insn generated in LRA       |Redundant insn generated in
                   |                            |LRA
      Known to fail|                            |4.8.0

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Not sure if we want to backport such change though.


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

* [Bug rtl-optimization/57518] [4.8/4.9 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
                   ` (3 preceding siblings ...)
  2013-06-24 10:20 ` [Bug rtl-optimization/57518] [4.8/4.9 " rguenth at gcc dot gnu.org
@ 2013-10-12  0:25 ` brooks at gcc dot gnu.org
  2013-10-14  8:08 ` [Bug rtl-optimization/57518] [4.8 " rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: brooks at gcc dot gnu.org @ 2013-10-12  0:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57518

Brooks Moses <brooks at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brooks at gcc dot gnu.org

--- Comment #5 from Brooks Moses <brooks at gcc dot gnu.org> ---
For the record, this is failing in the Google 4.8 branch (which has the
backported patch applied, along with the testcase) in our 32-bit Power builds. 
It may be worth seeing if that replicates on trunk.

Otherwise, since the relevant patch has been applied to trunk, shouldn't this
be closed?


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

* [Bug rtl-optimization/57518] [4.8 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
                   ` (4 preceding siblings ...)
  2013-10-12  0:25 ` brooks at gcc dot gnu.org
@ 2013-10-14  8:08 ` rguenth at gcc dot gnu.org
  2013-10-16  9:49 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-10-14  8:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57518

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-14
      Known to work|                            |4.9.0
            Summary|[4.8/4.9 Regression]        |[4.8 Regression] Redundant
                   |Redundant insn generated in |insn generated in LRA
                   |LRA                         |
     Ever confirmed|0                           |1

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.


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

* [Bug rtl-optimization/57518] [4.8 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
                   ` (5 preceding siblings ...)
  2013-10-14  8:08 ` [Bug rtl-optimization/57518] [4.8 " rguenth at gcc dot gnu.org
@ 2013-10-16  9:49 ` jakub at gcc dot gnu.org
  2013-11-04 14:07 ` hp at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-10-16  9:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57518

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.2                       |4.8.3

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.8.2 has been released.


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

* [Bug rtl-optimization/57518] [4.8 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
                   ` (6 preceding siblings ...)
  2013-10-16  9:49 ` jakub at gcc dot gnu.org
@ 2013-11-04 14:07 ` hp at gcc dot gnu.org
  2013-11-04 14:32 ` hp at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: hp at gcc dot gnu.org @ 2013-11-04 14:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57518

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hp at gcc dot gnu.org

--- Comment #8 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
Why is the test-case gcc.dg/pr57518.c valid?
It just checks that a REG_EQUIV is not attached, but from the analysis it seems
the need is to check the related register against some condition; the note
seems valid.  Or maybe the test-case should be made machine-specific.


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

* [Bug rtl-optimization/57518] [4.8 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
                   ` (7 preceding siblings ...)
  2013-11-04 14:07 ` hp at gcc dot gnu.org
@ 2013-11-04 14:32 ` hp at gcc dot gnu.org
  2014-05-22  9:06 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: hp at gcc dot gnu.org @ 2013-11-04 14:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57518

--- Comment #9 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
See also PR58985.


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

* [Bug rtl-optimization/57518] [4.8 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
                   ` (8 preceding siblings ...)
  2013-11-04 14:32 ` hp at gcc dot gnu.org
@ 2014-05-22  9:06 ` rguenth at gcc dot gnu.org
  2014-12-10 12:41 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-22  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.3                       |4.8.4

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 4.8.3 is being released, adjusting target milestone.


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

* [Bug rtl-optimization/57518] [4.8 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
                   ` (9 preceding siblings ...)
  2014-05-22  9:06 ` rguenth at gcc dot gnu.org
@ 2014-12-10 12:41 ` rguenth at gcc dot gnu.org
  2014-12-19 13:28 ` jakub at gcc dot gnu.org
  2015-06-23  8:42 ` rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-12-10 12:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
           Priority|P3                          |P2


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

* [Bug rtl-optimization/57518] [4.8 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
                   ` (10 preceding siblings ...)
  2014-12-10 12:41 ` rguenth at gcc dot gnu.org
@ 2014-12-19 13:28 ` jakub at gcc dot gnu.org
  2015-06-23  8:42 ` rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-12-19 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.4                       |4.8.5

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.8.4 has been released.


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

* [Bug rtl-optimization/57518] [4.8 Regression] Redundant insn generated in LRA
  2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
                   ` (11 preceding siblings ...)
  2014-12-19 13:28 ` jakub at gcc dot gnu.org
@ 2015-06-23  8:42 ` rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-23  8:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|4.8.5                       |4.9.0
      Known to fail|                            |4.8.5

--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for 4.9.0.


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

end of thread, other threads:[~2015-06-23  8:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-03 21:04 [Bug rtl-optimization/57518] New: Redundent insn generated in LRA wmi at google dot com
2013-06-12 21:47 ` [Bug rtl-optimization/57518] [4.8/4.9 Regression] Redundant " wmi at google dot com
2013-06-20  8:56 ` [Bug rtl-optimization/57518] [4.9 " rguenth at gcc dot gnu.org
2013-06-20 15:55 ` wmi at google dot com
2013-06-24 10:20 ` [Bug rtl-optimization/57518] [4.8/4.9 " rguenth at gcc dot gnu.org
2013-10-12  0:25 ` brooks at gcc dot gnu.org
2013-10-14  8:08 ` [Bug rtl-optimization/57518] [4.8 " rguenth at gcc dot gnu.org
2013-10-16  9:49 ` jakub at gcc dot gnu.org
2013-11-04 14:07 ` hp at gcc dot gnu.org
2013-11-04 14:32 ` hp at gcc dot gnu.org
2014-05-22  9:06 ` rguenth at gcc dot gnu.org
2014-12-10 12:41 ` rguenth at gcc dot gnu.org
2014-12-19 13:28 ` jakub at gcc dot gnu.org
2015-06-23  8:42 ` rguenth 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).