From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21835 invoked by alias); 16 Dec 2008 13:11:17 -0000 Received: (qmail 19978 invoked by uid 48); 16 Dec 2008 13:09:52 -0000 Date: Tue, 16 Dec 2008 13:11:00 -0000 Message-ID: <20081216130952.19977.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/37922] [4.4 Regression] code generation error In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jakub at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-12/txt/msg01607.txt.bz2 ------- Comment #11 from jakub at gcc dot gnu dot org 2008-12-16 13:09 ------- The problem is that CSE2 extends the live range of CC register, so before DSE1 we have in _ZN11rot_mx_infoC1ERK6rot_mx function: (insn 15 14 16 2 pr37922.C:469 (set (reg:CC 17 flags) (compare:CC (reg/v:SI 75 [ proper_order ]) (const_int 0 [0x0]))) 5 {*cmpsi_1_insn} (nil)) (jump_insn 16 15 17 2 pr37922.C:469 (set (pc) (if_then_else (eq (reg:CC 17 flags) (const_int 0 [0x0])) (label_ref:DI 128) (pc))) 618 {*jcc_1} (expr_list:REG_DEAD (reg:CC 17 flags) (expr_list:REG_BR_PROB (const_int 3900 [0xf3c]) (nil)))) ... (insn 28 27 30 3 pr37922.C:472 (set (reg:SI 71 [ proper_r$den_ ]) (mem/s/c:SI (plus:DI (reg/f:DI 20 frame) (const_int -60 [0xffffffffffffffc4])) [7 proper_r.den_+0 S4 A32])) 47 {*movsi_1} (nil)) (jump_insn 30 28 31 3 pr37922.C:475 (set (pc) (if_then_else (lt (reg:CC 17 flags) (const_int 0 [0x0])) (label_ref 35) (pc))) 618 {*jcc_1} (expr_list:REG_DEAD (reg:CC 17 flags) (expr_list:REG_BR_PROB (const_int 2700 [0xa8c]) (nil)))) and no insn in between jump_insn 16 and 30 touch the flags register (insn 29 which was comparing (reg:SI 75) and (const_int 0) was eliminated during CSE2). DSE in 4.3/4.4 then attempts to optimize the store of a 64-bit value in insn 27 followed by 32-bit read from the upper 32-bits of that value in insn 28, but the sequence it inserts for it (shift down by 32 bytes) unfortunately clobbers CC register, but replace_read doesn't check for that. Also, the REG_DEAD note which wasn't removed during CSE2 looks weird. I guess in replace_read before calling validate_change we should check if insns don't clobber or modify any hard registers that are live at that point, but am not sure if DF is initialized for such kind of query at this point. -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |zadeck at gcc dot gnu dot | |org Status|WAITING |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2008-12-16 13:09:52 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37922