From c927e7606c97878a0a683c155af62f30c3fd187b Mon Sep 17 00:00:00 2001 From: rearnsha Date: Fri, 17 Oct 2003 10:30:43 +0000 Subject: [PATCH] * flow.c (init_propagate_block_info): Don't abort if a conditional jump is not a comparison of a register. Instead, just don't record conditional life information. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72594 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 +++++ gcc/flow.c | 79 +++++++++++++++++++++++++++++++---------------------------- 2 files changed, 48 insertions(+), 37 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 640ad1a68a4..9882de6a5a8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-10-17 Richard Earnshaw + + * flow.c (init_propagate_block_info): Don't abort if a conditional + jump is not a comparison of a register. Instead, just don't record + conditional life information. + 2003-10-16 Jan Hubicka PR optimization/12630 diff --git a/gcc/flow.c b/gcc/flow.c index 66c04eecfa6..2694a0b07e0 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -1861,16 +1861,15 @@ init_propagate_block_info (basic_block bb, regset live, regset local_set, free_reg_cond_life_info); pbi->reg_cond_reg = BITMAP_XMALLOC (); - /* If this block ends in a conditional branch, for each register live - from one side of the branch and not the other, record the register - as conditionally dead. */ + /* If this block ends in a conditional branch, for each register + live from one side of the branch and not the other, record the + register as conditionally dead. */ if (GET_CODE (bb->end) == JUMP_INSN && any_condjump_p (bb->end)) { regset_head diff_head; regset diff = INITIALIZE_REG_SET (diff_head); basic_block bb_true, bb_false; - rtx cond_true, cond_false, set_src; int i; /* Identify the successor blocks. */ @@ -1898,53 +1897,59 @@ init_propagate_block_info (basic_block bb, regset live, regset local_set, bb_false = bb_true; } - /* Extract the condition from the branch. */ - set_src = SET_SRC (pc_set (bb->end)); - cond_true = XEXP (set_src, 0); - cond_false = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)), - GET_MODE (cond_true), XEXP (cond_true, 0), - XEXP (cond_true, 1)); - if (GET_CODE (XEXP (set_src, 1)) == PC) - { - rtx t = cond_false; - cond_false = cond_true; - cond_true = t; - } - /* Compute which register lead different lives in the successors. */ if (bitmap_operation (diff, bb_true->global_live_at_start, bb_false->global_live_at_start, BITMAP_XOR)) { + /* Extract the condition from the branch. */ + rtx set_src = SET_SRC (pc_set (bb->end)); + rtx cond_true = XEXP (set_src, 0); rtx reg = XEXP (cond_true, 0); if (GET_CODE (reg) == SUBREG) reg = SUBREG_REG (reg); - if (GET_CODE (reg) != REG) - abort (); + /* We can only track conditional lifetimes if the condition is + in the form of a comparison of a register against zero. + If the condition is more complex than that, then it is safe + not to record any information. */ + if (GET_CODE (reg) == REG + && XEXP (cond_true, 1) == const0_rtx) + { + rtx cond_false + = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)), + GET_MODE (cond_true), XEXP (cond_true, 0), + XEXP (cond_true, 1)); + if (GET_CODE (XEXP (set_src, 1)) == PC) + { + rtx t = cond_false; + cond_false = cond_true; + cond_true = t; + } - SET_REGNO_REG_SET (pbi->reg_cond_reg, REGNO (reg)); + SET_REGNO_REG_SET (pbi->reg_cond_reg, REGNO (reg)); - /* For each such register, mark it conditionally dead. */ - EXECUTE_IF_SET_IN_REG_SET - (diff, 0, i, - { - struct reg_cond_life_info *rcli; - rtx cond; + /* For each such register, mark it conditionally dead. */ + EXECUTE_IF_SET_IN_REG_SET + (diff, 0, i, + { + struct reg_cond_life_info *rcli; + rtx cond; - rcli = xmalloc (sizeof (*rcli)); + rcli = xmalloc (sizeof (*rcli)); - if (REGNO_REG_SET_P (bb_true->global_live_at_start, i)) - cond = cond_false; - else - cond = cond_true; - rcli->condition = cond; - rcli->stores = const0_rtx; - rcli->orig_condition = cond; + if (REGNO_REG_SET_P (bb_true->global_live_at_start, i)) + cond = cond_false; + else + cond = cond_true; + rcli->condition = cond; + rcli->stores = const0_rtx; + rcli->orig_condition = cond; - splay_tree_insert (pbi->reg_cond_dead, i, - (splay_tree_value) rcli); - }); + splay_tree_insert (pbi->reg_cond_dead, i, + (splay_tree_value) rcli); + }); + } } FREE_REG_SET (diff); -- 2.11.4.GIT