From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5778 invoked by alias); 17 Sep 2008 00:42:53 -0000 Received: (qmail 5769 invoked by uid 22791); 17 Sep 2008 00:42:52 -0000 X-Spam-Check-By: sourceware.org Received: from e1.ny.us.ibm.com (HELO e1.ny.us.ibm.com) (32.97.182.141) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 17 Sep 2008 00:42:11 +0000 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e1.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m8H0g9na010635 for ; Tue, 16 Sep 2008 20:42:09 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m8H0g9xa241666 for ; Tue, 16 Sep 2008 20:42:09 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m8H0g8jP028038 for ; Tue, 16 Sep 2008 20:42:08 -0400 Received: from [192.168.1.102] (vorma.rchland.ibm.com [9.10.86.174]) by d01av02.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m8H0g704027985; Tue, 16 Sep 2008 20:42:08 -0400 Subject: Re: Patch to fix gcc.c-torture/compile/20010102-1.c on IA64 HP-UX From: Peter Bergner To: sje@cup.hp.com Cc: Jeff Law , gcc-patches@gcc.gnu.org, paolo.carlini@oracle.com In-Reply-To: <1221599039.17787.34.camel@hpsje.cup.hp.com> References: <200809161651.m8GGpEM19079@lucas.cup.hp.com> <1221589231.6367.14.camel@sjoa> <1221590867.17787.18.camel@hpsje.cup.hp.com> <48D005A1.1070405@redhat.com> <1221593957.6367.24.camel@sjoa> <48D013ED.3050402@redhat.com> <1221596846.17787.28.camel@hpsje.cup.hp.com> <48D01A84.6020605@redhat.com> <1221599039.17787.34.camel@hpsje.cup.hp.com> Content-Type: text/plain Date: Wed, 17 Sep 2008 01:54:00 -0000 Message-Id: <1221612127.9338.17.camel@sjoa> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2008-09/txt/msg01177.txt.bz2 On Tue, 2008-09-16 at 14:03 -0700, Steve Ellcey wrote: > Peter was questioning whether or not we should be setting REG_POINTER on > hard registers in regrename.c. But I just did a quick experiment and if > I change my patch to only set REG_POINTER on psuedo-regs then it doesn't > fix the bug. I did try his predicate change as an alternative: > > --- config/ia64/predicates.md (revision 140251) > +++ config/ia64/predicates.md (working copy) > @@ -585,6 +585,6 @@ (define_predicate "ar_pfs_reg_operand" > (define_predicate "basereg_operand" > (match_operand 0 "register_operand") > { > - return REG_P (op) && REG_POINTER (op); > + return REG_P (op) && REG_POINTER (regno_reg_rtx[ORIGINAL_REGNO(op)]); > }) > > And that did fix the test case I have (I didn't do a full testing). > But it seems that if we aren't setting REG_POINTER for hard regs in > regrename.c then we shouldn't be copying attributes for them either and > we are doing that. I think Jeff and I agree that setting REG_POINTER on hard regs is wrong, given the issues discovered in PR36533. That is why we disabled setting REG_POINTER and REG_ATTRS in set_reg_attrs_from_value(). I think that is what is tickling your basereg_operand predicate test, because now hard regs we used to erroneously set the REG_POINTER, no longer have it set. ISTM, the real fix is to change your predicate to check whether ORIGINAL_REGNO has the REG_POINTER rather than op (like above), since op can be a hard reg and hard regs shouldn't have REG_POINTER set. As for the regrename.c change, can't we just do the (untested!) code below which will not set REG_POINTER or REG_ATTRS on hard regs? Peter Index: regrename.c =================================================================== --- regrename.c (revision 140251) +++ regrename.c (working copy) @@ -356,12 +356,11 @@ do_replace (struct du_chain *chain, int while (chain) { unsigned int regno = ORIGINAL_REGNO (*chain->loc); - struct reg_attrs * attr = REG_ATTRS (*chain->loc); - *chain->loc = gen_raw_REG (GET_MODE (*chain->loc), reg); + *chain->loc = gen_reg_rtx_and_attrs (*chain->loc); + SET_REGNO (*chain->loc, reg); if (regno >= FIRST_PSEUDO_REGISTER) ORIGINAL_REGNO (*chain->loc) = regno; - REG_ATTRS (*chain->loc) = attr; df_insn_rescan (chain->insn); chain = chain->next_use; } @@ -1374,7 +1373,7 @@ find_oldest_value_reg (enum reg_class cl if (new_rtx) { ORIGINAL_REGNO (new_rtx) = ORIGINAL_REGNO (reg); - REG_ATTRS (new_rtx) = REG_ATTRS (reg); + set_reg_attrs_from_value (new_rtx, reg); return new_rtx; } } @@ -1672,7 +1671,7 @@ copyprop_hardreg_forward_1 (basic_block if (validate_change (insn, &SET_SRC (set), new_rtx, 0)) { ORIGINAL_REGNO (new_rtx) = ORIGINAL_REGNO (src); - REG_ATTRS (new_rtx) = REG_ATTRS (src); + set_reg_attrs_from_value (new_rtx, src); if (dump_file) fprintf (dump_file, "insn %u: replaced reg %u with %u\n", Index: config/ia64/predicates.md =================================================================== --- config/ia64/predicates.md (revision 140251) +++ config/ia64/predicates.md (working copy) @@ -585,6 +585,6 @@ (define_predicate "ar_pfs_reg_operand" (define_predicate "basereg_operand" (match_operand 0 "register_operand") { - return REG_P (op) && REG_POINTER (op); + return REG_P (op) && REG_POINTER (regno_reg_rtx[ORIGINAL_REGNO (op)]); })