public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Richard Earnshaw <rearnsha@arm.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: optimization/10592: [arm] caller-save incorrectly handles a reloaded SET_DEST operand Date: Fri, 02 May 2003 13:46:00 -0000 [thread overview] Message-ID: <20030502134601.7287.qmail@sources.redhat.com> (raw) The following reply was made to PR optimization/10592; it has been noted by GNATS. From: Richard Earnshaw <rearnsha@arm.com> To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, ryan.pipkin@inet.com, law@redhat.com Cc: Richard.Earnshaw@arm.com Subject: Re: optimization/10592: [arm] caller-save incorrectly handles a reloaded SET_DEST operand Date: Fri, 02 May 2003 14:45:33 +0100 [Jeff, I've put you on CC because you appear to be the original author of the relevant code (back in Oct 98).] Some more detailed analysis... The problem we have here comes from the use of caller-save register allocation and the failure to allocate a register to a pseudo that is equivalent to a memory location that is derived from a caller-saved register value. Specifically, we have the sequence prior to reload of (call_insn:HI 249 227 326 2 0x4067c5d8 (parallel [ (set (reg:SI 0 r0) (call (mem:SI (symbol_ref:SI ("strncpy") <function_decl 0x40330af8 strncpy>) [0 S4 A32]) (const_int 0 [0x0]))) (use (const_int 0 [0x0])) (clobber (reg:SI 14 lr)) ]) 190 {*call_value_symbol} (insn_list:REG_DEP_ANTI 76 (insn_list 248 (insn_list 247 (insn_list 246 (insn_list:REG_DEP_ANTI 30 (insn_list:REG_DEP_ANTI 172 (insn_list 210 (insn_list:REG_DEP_ANTI 75 (insn_list:REG_DEP_ANTI 74 (insn_list 47 (insn_list 227 (nil)))))))))))) (expr_list:REG_DEAD (reg:SI 1 r1 [ pName ]) (expr_list:REG_DEAD (reg:SI 2 r2) (expr_list:REG_UNUSED (reg:SI 0 r0) (expr_list:REG_UNUSED (reg:SI 14 lr) (expr_list:REG_EH_REGION (const_int 0 [0x0]) (nil)))))) (expr_list (use (reg:SI 2 r2)) (expr_list (use (reg:SI 1 r1 [ pName ])) (expr_list (use (reg:SI 0 r0)) (nil))))) (insn:HI 326 249 331 2 0x40658dc0 (set (reg:SI 98) (plus:SI (reg/v:SI 49 [ base ]) (const_int 156 [0x9c]))) 4 {*arm_addsi3} (insn_list 4 (insn_list:REG_DEP_ANTI 249 (nil))) (expr_list:REG_EQUIV (mem/s:SI (plus:SI (reg/v/u/f:SI 48 [ this ]) (const_int 540 [0x21c])) [39 <variable>.pValue3+0 S4 A32]) (nil))) Note that pseudo 98 has a REG_EQUIV of mem(plus (r48, 540)) Now global-alloc assigns r48 to the call-clobbered register r12, but spills r98 back into its reg_equiv location. When save_call_clobbered_res runs, therefore, r12 is stored to the stack before the call insn, but when scanning r326 mark_referenced_regs ignores the SET_DEST in insn 326 because it is a REG: if (code == SET || code == CLOBBER) { x = SET_DEST (x); code = GET_CODE (x); if (code == REG || code == PC || code == CC0 || (code == SUBREG && GET_CODE (SUBREG_REG (x)) == REG /* If we're setting only part of a multi-word register, we shall mark it as referenced, because the words that are not being set should be restored. */ && ((GET_MODE_SIZE (GET_MODE (x)) >= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) || (GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) <= UNITS_PER_WORD)))) return; We thus end up with the sequence of instructions str ip, [frame+xxx] call strncpy add tmp, r9, #156 str tmp, [ip+540] // ip not restored first I think the fix may be to make mark_referenced_regs only return if REG is a hard register (similarly for SUBREG). Jeff, any thoughts? R.
next reply other threads:[~2003-05-02 13:46 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-05-02 13:46 Richard Earnshaw [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-05-02 14:06 Richard Earnshaw 2003-05-02 13:15 rearnsha
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030502134601.7287.qmail@sources.redhat.com \ --to=rearnsha@arm.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).