This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: PR 34415: dbr_schedule vs. uninitialised registers
Eric Botcazou <ebotcazou@libertysurf.fr> writes:
>> Well, that would work too, but would make the register unnecessarily
>> live in cases where my patch wouldn't (i.e. between the barrier and
>> the place where the register really does become live). I'm happy
>> to do it that way instead if you prefer though.
>
> My understanding is that resource.c was written with the flow.c way of
> doing things in mind (in particular backward propagation) so, barring
> the scrapping of resource.c itself, I think we'd better keep using a
> backward problem, i.e. LR instead of LIVE, for resource.c.
OK, here's the patch. Regression-tested on mipsisa64-elfoabi,
OK to install?
Richard
gcc/
PR rtl-optimization/34415
* df.h (DF_LR_IN, DF_LR_OUT): Update comments.
* resource.c (mark_target_live_regs): Use DF_LR_IN rather than
df_get_live_in. Don't handle pseudos.
gcc/testsuite/
PR rtl-optimization/34415
* gcc.c-torture/execute/pr34415.c: New test.
Index: gcc/df.h
===================================================================
--- gcc/df.h 2007-12-15 10:23:43.000000000 +0000
+++ gcc/df.h 2007-12-15 10:23:46.000000000 +0000
@@ -559,9 +559,9 @@ #define DF_LIVE_BB_INFO(BB) (df_live_get
#define DF_LIVE_IN(BB) (DF_LIVE_BB_INFO(BB)->in)
#define DF_LIVE_OUT(BB) (DF_LIVE_BB_INFO(BB)->out)
-/* These macros are currently used by only reg-stack since it is not
- tolerant of uninitialized variables. This intolerance should be
- fixed because it causes other problems. */
+/* These macros are used by passes that are not tolerant of
+ uninitialized variables. This intolerance should eventually
+ be fixed. */
#define DF_LR_IN(BB) (DF_LR_BB_INFO(BB)->in)
#define DF_LR_OUT(BB) (DF_LR_BB_INFO(BB)->out)
Index: gcc/resource.c
===================================================================
--- gcc/resource.c 2007-12-15 10:23:43.000000000 +0000
+++ gcc/resource.c 2007-12-15 10:57:26.000000000 +0000
@@ -958,9 +958,8 @@ mark_target_live_regs (rtx insns, rtx ta
TARGET. Otherwise, we must assume everything is live. */
if (b != -1)
{
- regset regs_live = df_get_live_in (BASIC_BLOCK (b));
+ regset regs_live = DF_LR_IN (BASIC_BLOCK (b));
rtx start_insn, stop_insn;
- reg_set_iterator rsi;
/* Compute hard regs live at start of block -- this is the real hard regs
marked live, plus live pseudo regs that have been renumbered to
@@ -968,13 +967,6 @@ mark_target_live_regs (rtx insns, rtx ta
REG_SET_TO_HARD_REG_SET (current_live_regs, regs_live);
- EXECUTE_IF_SET_IN_REG_SET (regs_live, FIRST_PSEUDO_REGISTER, i, rsi)
- {
- if (reg_renumber[i] >= 0)
- add_to_hard_reg_set (¤t_live_regs, PSEUDO_REGNO_MODE (i),
- reg_renumber[i]);
- }
-
/* Get starting and ending insn, handling the case where each might
be a SEQUENCE. */
start_insn = (b == ENTRY_BLOCK_PTR->next_bb->index ?
Index: gcc/testsuite/gcc.c-torture/execute/pr34415.c
===================================================================
--- /dev/null 2007-12-15 09:13:22.548096750 +0000
+++ gcc/testsuite/gcc.c-torture/execute/pr34415.c 2007-12-15 10:23:46.000000000 +0000
@@ -0,0 +1,34 @@
+const char *__attribute__((noinline))
+foo (const char *p)
+{
+ const char *end;
+ int len = 1;
+ for (;;)
+ {
+ int c = *p;
+ c = (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c);
+ if (c == 'B')
+ end = p;
+ else if (c == 'A')
+ {
+ end = p;
+ do
+ p++;
+ while (*p == '+');
+ }
+ else
+ break;
+ p++;
+ len++;
+ }
+ if (len > 2 && *p == ':')
+ p = end;
+ return p;
+}
+
+int
+main (void)
+{
+ const char *input = "Bbb:";
+ return foo (input) != input + 2;
+}