From cee784f5fb2330dfca9b64f4ae8c5d707b00ac7c Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Wed, 8 Aug 2012 06:29:12 +0000 Subject: [PATCH] re PR middle-end/54146 (Very slow compile with attribute((flatten))) PR middle-end/54146 * ira.c (init_live_subregs): Take live_subregs_used as a bitmap. (build_insn_chain): Make live_subregs_used a bitmap. Use SBITMAP_SIZE to ignore the paradoxical bytes of subregs. Use sbitmap_free to free the live_subreg sbitmaps. From-SVN: r190223 --- gcc/ChangeLog | 6 ++++++ gcc/ira.c | 39 +++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bb7d9c61b49..f0687ad1c8f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2012-08-08 Steven Bosscher + PR middle-end/54146 + * ira.c (init_live_subregs): Take live_subregs_used as a bitmap. + (build_insn_chain): Make live_subregs_used a bitmap. + Use SBITMAP_SIZE to ignore the paradoxical bytes of subregs. + Use sbitmap_free to free the live_subreg sbitmaps. + PR middle-end/54146 * ifcvt.c: Include pointer-set.h. (cond_move_process_if_block): Change type of then_regs and diff --git a/gcc/ira.c b/gcc/ira.c index 3825498bc67..6699d2bacf7 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -3251,7 +3251,7 @@ pseudo_for_reload_consideration_p (int regno) initialization. ALLOCNUM need not be the regno of REG. */ static void init_live_subregs (bool init_value, sbitmap *live_subregs, - int *live_subregs_used, int allocnum, rtx reg) + bitmap live_subregs_used, int allocnum, rtx reg) { unsigned int regno = REGNO (SUBREG_REG (reg)); int size = GET_MODE_SIZE (GET_MODE (regno_reg_rtx[regno])); @@ -3259,10 +3259,10 @@ init_live_subregs (bool init_value, sbitmap *live_subregs, gcc_assert (size > 0); /* Been there, done that. */ - if (live_subregs_used[allocnum]) + if (bitmap_bit_p (live_subregs_used, allocnum)) return; - /* Create a new one with zeros. */ + /* Create a new one. */ if (live_subregs[allocnum] == NULL) live_subregs[allocnum] = sbitmap_alloc (size); @@ -3273,8 +3273,7 @@ init_live_subregs (bool init_value, sbitmap *live_subregs, else sbitmap_zero (live_subregs[allocnum]); - /* Set the number of bits that we really want. */ - live_subregs_used[allocnum] = size; + bitmap_set_bit (live_subregs_used, allocnum); } /* Walk the insns of the current function and build reload_insn_chain, @@ -3293,11 +3292,11 @@ build_insn_chain (void) which hardregs are live in multiword pseudos. live_subregs and live_subregs_used are indexed by pseudo number. The live_subreg entry for a particular pseudo is only used if the corresponding - element is non zero in live_subregs_used. The value in - live_subregs_used is number of bytes that the pseudo can + element is non zero in live_subregs_used. The sbitmap size of + live_subreg[allocno] is number of bytes that the pseudo can occupy. */ sbitmap *live_subregs = XCNEWVEC (sbitmap, max_regno); - int *live_subregs_used = XNEWVEC (int, max_regno); + bitmap live_subregs_used = BITMAP_ALLOC (NULL); for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) if (TEST_HARD_REG_BIT (eliminable_regset, i)) @@ -3308,7 +3307,7 @@ build_insn_chain (void) rtx insn; CLEAR_REG_SET (live_relevant_regs); - memset (live_subregs_used, 0, max_regno * sizeof (int)); + bitmap_clear (live_subregs_used); EXECUTE_IF_SET_IN_BITMAP (DF_LR_OUT (bb), 0, i, bi) { @@ -3393,8 +3392,8 @@ build_insn_chain (void) } /* Ignore the paradoxical bits. */ - if ((int)last > live_subregs_used[regno]) - last = live_subregs_used[regno]; + if (last > SBITMAP_SIZE (live_subregs[regno])) + last = SBITMAP_SIZE (live_subregs[regno]); while (start < last) { @@ -3404,7 +3403,7 @@ build_insn_chain (void) if (sbitmap_empty_p (live_subregs[regno])) { - live_subregs_used[regno] = 0; + bitmap_clear_bit (live_subregs_used, regno); bitmap_clear_bit (live_relevant_regs, regno); } else @@ -3422,8 +3421,8 @@ build_insn_chain (void) modeling the def as a killing def. */ if (!DF_REF_FLAGS_IS_SET (def, DF_REF_PARTIAL)) { + bitmap_clear_bit (live_subregs_used, regno); bitmap_clear_bit (live_relevant_regs, regno); - live_subregs_used[regno] = 0; } } } @@ -3479,8 +3478,8 @@ build_insn_chain (void) live_subregs, live_subregs_used, regno, reg); /* Ignore the paradoxical bits. */ - if ((int)last > live_subregs_used[regno]) - last = live_subregs_used[regno]; + if (last > SBITMAP_SIZE (live_subregs[regno])) + last = SBITMAP_SIZE (live_subregs[regno]); while (start < last) { @@ -3493,7 +3492,7 @@ build_insn_chain (void) effectively saying do not use the subregs because we are reading the whole pseudo. */ - live_subregs_used[regno] = 0; + bitmap_clear_bit (live_subregs_used, regno); bitmap_set_bit (live_relevant_regs, regno); } } @@ -3536,14 +3535,14 @@ build_insn_chain (void) } } - for (i = 0; i < (unsigned int) max_regno; i++) - free (live_subregs[i]); - reload_insn_chain = c; *p = NULL; + for (i = 0; i < (unsigned int) max_regno; i++) + if (live_subregs[i] != NULL) + sbitmap_free (live_subregs[i]); free (live_subregs); - free (live_subregs_used); + BITMAP_FREE (live_subregs_used); BITMAP_FREE (live_relevant_regs); BITMAP_FREE (elim_regset); -- 2.30.2