From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97853 invoked by alias); 7 Jul 2015 19:35:16 -0000 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 Received: (qmail 97812 invoked by uid 48); 7 Jul 2015 19:35:11 -0000 From: "vmakarov at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/66334] cleanup block fails to initialize EBX Date: Tue, 07 Jul 2015 19:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: vmakarov at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 6.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg00570.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66334 --- Comment #11 from Vladimir Makarov --- (In reply to H.J. Lu from comment #10) > (In reply to Vladimir Makarov from comment #9) > > > > I will work on the patch and commit it on next week. > > > > Thanks. > > I tried this patch: > > https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff; > h=ab377c74f283f3db51b4e250b9c7acecc32e8ff8 > > It seems to work. Thanks, H.J. Your patch fixes given problem but I'd like to play more safe. May be there are some analogous situations with explicit ebx setting. So I am going to submit the following patch today or tomorrow. Index: ChangeLog =================================================================== --- ChangeLog (revision 225200) +++ ChangeLog (working copy) @@ -1,3 +1,10 @@ +2015-07-06 Vladimir Makarov + + PR middle-end/66334 + * ira-lives.c (process_bb_node_lives): Make conflicts with PIC + hard regno live at the start of BB with incoming abnormal edges. + * lra-lives.c (process_bb_lives): Ditto. + 2015-06-30 Vladimir Makarov PR debug/66691 Index: ira-lives.c =================================================================== --- ira-lives.c (revision 225134) +++ ira-lives.c (working copy) @@ -1346,7 +1346,21 @@ process_bb_node_lives (ira_loop_tree_nod allocate such regs in this case. */ if (!cfun->has_nonlocal_label && bb_has_abnormal_call_pred (bb)) for (px = 0; px < FIRST_PSEUDO_REGISTER; px++) - if (call_used_regs[px]) + if (call_used_regs[px] +#ifdef REAL_PIC_OFFSET_TABLE_REGNUM + /* We should create a conflict of PIC pseudo with + PIC hard reg as PIC hard reg can have a wrong + value after jump described by the abnormal edge. + In this case we can not allocate PIC hard reg to + PIC pseudo as PIC pseudo will also have a wrong + value. This code is not critical as LRA can fix + it but it is better to have the right allocation + earlier. */ + || (px == REAL_PIC_OFFSET_TABLE_REGNUM + && pic_offset_table_rtx != NULL_RTX + && REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER) +#endif + ) make_hard_regno_born (px); } Index: lra-lives.c =================================================================== --- lra-lives.c (revision 225200) +++ lra-lives.c (working copy) @@ -957,7 +957,18 @@ process_bb_lives (basic_block bb, int &c allocate such regs in this case. */ if (!cfun->has_nonlocal_label && bb_has_abnormal_call_pred (bb)) for (px = 0; px < FIRST_PSEUDO_REGISTER; px++) - if (call_used_regs[px]) + if (call_used_regs[px] +#ifdef REAL_PIC_OFFSET_TABLE_REGNUM + /* We should create a conflict of PIC pseudo with PIC + hard reg as PIC hard reg can have a wrong value after + jump described by the abnormal edge. In this case we + can not allocate PIC hard reg to PIC pseudo as PIC + pseudo will also have a wrong value. */ + || (px == REAL_PIC_OFFSET_TABLE_REGNUM + && pic_offset_table_rtx != NULL_RTX + && REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER) +#endif + ) make_hard_regno_born (px, false); }