public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* CSE versus libcall independency
@ 2001-11-13 15:03 Jan Hubicka
  2001-11-16  9:18 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Hubicka @ 2001-11-13 15:03 UTC (permalink / raw)
  To: gcc-patches, rth, gcc-pdo


Hi,
on the cfg branch I get failure when compiling following libcall sequence:
(insn 81 76 78 (clobber (reg:DI 84)) -1 (nil)
    (insn_list:REG_LIBCALL 83 (nil)))

(insn 78 81 80 (parallel[
            (set (subreg:SI (reg:DI 84) 0)
                (xor:SI (subreg:SI (reg/v:DI 71) 0)
                    (subreg:SI (reg:DI 83) 0)))
            (clobber (reg:CC 17 flags))
        ] ) -1 (nil)
    (expr_list:REG_NO_CONFLICT (reg/v:DI 71)
        (expr_list:REG_NO_CONFLICT (reg:DI 83)
            (nil))))

(insn 80 78 83 (parallel[
            (set (subreg:SI (reg:DI 84) 4)
                (xor:SI (subreg:SI (reg/v:DI 71) 4)
                    (subreg:SI (reg:DI 83) 4)))
            (clobber (reg:CC 17 flags))
        ] ) -1 (nil)
    (expr_list:REG_NO_CONFLICT (reg/v:DI 71)
        (expr_list:REG_NO_CONFLICT (reg:DI 83)
            (nil))))

(insn 83 80 85 (set (reg:DI 84)
        (reg:DI 84)) -1 (nil)
    (insn_list:REG_RETVAL 81 (expr_list:REG_EQUAL (xor:DI (reg/v:DI 71)
                (reg:DI 83))
            (nil))))

The webizer convert insn 83 to non-noop move:

(insn 83 80 85 (set (reg:DI 122)
        (reg:DI 121)) -1 (nil)
    (insn_list:REG_RETVAL 81 (expr_list:REG_EQUAL (xor:DI (reg:DI 120)
                (reg:DI 119))
            (nil))))

and CSE record equivalence 122 and 121 replacing register 122 by 121
after libcall making libcall apparently dead and removed.

IMO CSE behaviour is wrong.  I am fixing it by the attached patch.
The comment in front of if appears to agree with me that the equivalence
should not be recorded, but for some purpose registers are special cased.

Why?

Is such patch OK for mainline?

Sat Nov 17 21:06:42 CET 2001  Jan Hubicka  <jh@suse.cz>
	* cse.c (cse_insn): really do not record equivalences of the
	last instruction.
*** cse.c.old	Sat Nov 17 23:04:10 2001
--- cse.c	Sat Nov 17 23:04:45 2001
*************** cse_insn (insn, libcall_insn)
*** 5913,5921 ****
  		/* Don't put a hard register source into the table if this is
  		   the last insn of a libcall.  In this case, we only need
  		   to put src_eqv_elt in src_elt.  */
! 		if (GET_CODE (src) != REG
! 		    || REGNO (src) >= FIRST_PSEUDO_REGISTER
! 		    || ! find_reg_note (insn, REG_RETVAL, NULL_RTX))
  		  {
  		    struct table_elt *elt;
  
--- 5913,5919 ----
  		/* Don't put a hard register source into the table if this is
  		   the last insn of a libcall.  In this case, we only need
  		   to put src_eqv_elt in src_elt.  */
! 		if (! find_reg_note (insn, REG_RETVAL, NULL_RTX))
  		  {
  		    struct table_elt *elt;
  

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

* Re: CSE versus libcall independency
  2001-11-13 15:03 CSE versus libcall independency Jan Hubicka
@ 2001-11-16  9:18 ` Richard Henderson
  2001-11-26 15:08   ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2001-11-16  9:18 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches, gcc-pdo

On Sat, Nov 17, 2001 at 09:10:06PM +0100, Jan Hubicka wrote:
> 	* cse.c (cse_insn): really do not record equivalences of the
> 	last instruction.

Ok.


r~

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

* Re: CSE versus libcall independency
  2001-11-16  9:18 ` Richard Henderson
@ 2001-11-26 15:08   ` Richard Henderson
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2001-11-26 15:08 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches, gcc-pdo

On Sat, Nov 17, 2001 at 09:10:06PM +0100, Jan Hubicka wrote:
> 	* cse.c (cse_insn): really do not record equivalences of the
> 	last instruction.

Ok.


r~

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

end of thread, other threads:[~2001-11-26 23:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-13 15:03 CSE versus libcall independency Jan Hubicka
2001-11-16  9:18 ` Richard Henderson
2001-11-26 15:08   ` Richard Henderson

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).