From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23617 invoked by alias); 25 Mar 2003 12:12:20 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 23610 invoked from network); 25 Mar 2003 12:12:19 -0000 Received: from unknown (HELO mta07ps.bigpond.com) (144.135.25.132) by sources.redhat.com with SMTP; 25 Mar 2003 12:12:19 -0000 Received: from bubble.local ([144.135.25.84]) by mta07ps.bigpond.com (Netscape Messaging Server 4.15 mta07ps Jul 16 2002 22:47:55) with SMTP id HCB0KG00.9RK for ; Tue, 25 Mar 2003 22:12:16 +1000 Received: from CPE-144-136-188-60.sa.bigpond.net.au ([144.136.188.60]) by psmam06bpa.bigpond.com(MailRouter V3.2g 116/6863760); 25 Mar 2003 22:12:16 Received: (qmail 23625 invoked by uid 179); 25 Mar 2003 12:12:16 -0000 Date: Tue, 25 Mar 2003 14:02:00 -0000 From: Alan Modra To: gcc@gcc.gnu.org Subject: REQ_EQUAL and mems hoisted out of loops Message-ID: <20030325121216.GL931@bubble.sa.bigpond.net.au> Mail-Followup-To: gcc@gcc.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2003-03/txt/msg01523.txt.bz2 gcc.c-torture/execute/991202-1.c has been failing at -O2 on powerpc64-linux for some time. The following rtl is just before cse2 goes wild. When cse_insn looks at insn 50, it decides that insn 30 calculates the same value and simplifies insn 50 down to (set:DI (reg:DI 138) (reg:DI 127)) Oops, reg 145 has changed in the meantime at insn 41. From what I can tell, the REG_EQUAL notes in combination with the fact that the store to "y" has been moved out of the loop by loop optimization, is the cause of cse confusion. So it seems a possible fix would be to delete all REG_EQUAL notes that mention any mem hoisted out of a loop. Before I try to do that, I thought I'd solicit comments on the approach. Reasonable? (insn 30 28 31 1 (nil) (set:DI (reg:DI 127) (zero_extend:DI (reg/v:SI 145))) -1 (nil) (expr_list:REG_EQUAL (zero_extend:DI (mem/f:SI (symbol_ref:DI ("y")) [3 y+0 S4 A32])) (nil))) (insn 31 30 32 1 (nil) (set (reg:SI 128) (subreg:SI (reg:DI 127) 4)) -1 (nil) (nil)) (insn 32 31 34 1 (nil) (set (reg/v:SI 148) (subreg:SI (reg:DI 127) 4)) 300 {*movsi_internal1} (nil) (nil)) (insn 34 32 36 1 (nil) (use (symbol_ref:DI ("y"))) -1 (nil) (nil)) (insn 36 34 41 1 (nil) (use (symbol_ref:DI ("y"))) -1 (nil) (nil)) (insn 41 36 43 1 (nil) (set (reg/v:SI 145) (ashift:SI (reg:SI 128) (const_int 1 [0x1]))) -1 (nil) (expr_list:REG_EQUAL (ashift:SI (reg:SI 128) (const_int 1 [0x1])) (nil))) (note 43 41 46 1 NOTE_INSN_LOOP_CONT) (insn 46 43 48 1 (nil) (use (symbol_ref:DI ("y"))) -1 (nil) (nil)) (insn 48 46 50 1 (nil) (use (symbol_ref:DI ("x"))) -1 (nil) (nil)) (insn 50 48 51 1 (nil) (set:DI (reg:DI 138) (zero_extend:DI (reg/v:SI 145))) -1 (nil) (expr_list:REG_EQUAL (zero_extend:DI (mem/f:SI (symbol_ref:DI ("y")) [3 y+0 S4 A32])) (nil))) -- Alan Modra IBM OzLabs - Linux Technology Centre