public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/65379] New: ifcvt does not clean up dead instructions
@ 2015-03-10 16:40 krebbel at gcc dot gnu.org
  2015-03-11  9:37 ` [Bug rtl-optimization/65379] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: krebbel at gcc dot gnu.org @ 2015-03-10 16:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65379
           Summary: ifcvt does not clean up dead instructions
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: krebbel at gcc dot gnu.org

Created attachment 35002
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35002&action=edit
Experimental and way too expensive fix

the combine pass sometimes gets confused by already dead compares
which are remains of the if conversion pass.  This e.g. happens in
gcc.dg/builtin-bswap-7.c.  Compiling with -march=z196 the if blocks
are modified to make use of load on condition. This duplicates the
compare insn but unfortunately ifcvt fails to clean it up and the
additional compare survives until the second ifcvt pass. Combine fails
to do the simplification of the bswap since the bswapped value appears
to be used in the second compare as well.

ifcvt runs df_analyze in a loop until nothing changes anymore. So this
loop is always left with all df solutions being clean. However, dce is
only run once, before the first iteration.

ce1:

(insn 2 4 3 2 (set (reg/v:DI 64 [ a ])
        (reg:DI 2 %r2 [ a ]))
/home3/andreas/gcc/gcc/testsuite/gcc.dg/builtin-bswap-7.c:15 863 {*movdi_64}
     (expr_list:REG_DEAD (reg:DI 2 %r2 [ a ])
        (nil)))
(note 3 2 6 2 NOTE_INSN_FUNCTION_BEG)
(insn 6 3 7 2 (set (reg:DI 60 [ D.2056 ])
        (bswap:DI (reg/v:DI 64 [ a ])))
/home3/andreas/gcc/gcc/testsuite/gcc.dg/builtin-bswap-7.c:16 1501 {bswapdi2}
     (expr_list:REG_DEAD (reg/v:DI 64 [ a ])
        (nil)))
(insn 7 6 8 2 (set (reg:SI 66 [ D.2057+-3 ])
        (const_int 1 [0x1])) 867 {*movsi_zarch}
     (nil))
(insn 8 7 22 2 (set (reg:CCZ 33 %cc)
        (compare:CCZ (reg:DI 60 [ D.2056 ])
            (const_int 42949672960 [0xa00000000]))) 822 {*cmpdi_cct}
     (expr_list:REG_DEAD (reg:DI 60 [ D.2056 ])
        (nil)))
(insn 22 8 23 2 (set (reg:SI 70)
        (const_int 1 [0x1])) 867 {*movsi_zarch}
     (nil))
(insn 23 22 24 2 (set (reg:SI 71)
        (const_int 0 [0])) 867 {*movsi_zarch}
     (nil))
(insn 24 23 25 2 (set (reg:CCZ 33 %cc)
        (compare:CCZ (reg:DI 60 [ D.2056 ])
            (const_int 42949672960 [0xa00000000]))) 822 {*cmpdi_cct}
     (nil))
(insn 25 24 12 2 (set (reg:SI 66 [ D.2057+-3 ])
        (if_then_else:SI (eq (reg:CCZ 33 %cc)
                (const_int 0 [0]))
            (reg:SI 70)
            (reg:SI 71))) 1234 {*movsicc}


Hence combine must assume that r60 is still needed for insn 24 although this
insn should have been removed already. Combine tries to match the following
insn what fails:
(parallel [
        (set (reg:CCZ 33 %cc)
            (compare:CCZ (bswap:DI (reg:DI 2 %r2 [ a ]))
                (const_int 42949672960 [0xa00000000])))
        (set (reg:DI 60 [ D.2056 ])
            (bswap:DI (reg:DI 2 %r2 [ a ])))
    ])


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

* [Bug rtl-optimization/65379] ifcvt does not clean up dead instructions
  2015-03-10 16:40 [Bug rtl-optimization/65379] New: ifcvt does not clean up dead instructions krebbel at gcc dot gnu.org
@ 2015-03-11  9:37 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-11  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-03-11
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.


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

end of thread, other threads:[~2015-03-11  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-10 16:40 [Bug rtl-optimization/65379] New: ifcvt does not clean up dead instructions krebbel at gcc dot gnu.org
2015-03-11  9:37 ` [Bug rtl-optimization/65379] " 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).