Commit 2d73cc45 by Martin Jambor Committed by Martin Jambor

re PR rtl-optimization/59099 (Erroneous register allocation on 32-bit x86 using regparm)

2013-11-19  Martin Jambor  <mjambor@suse.cz>

	PR rtl-optimization/59099
	* ira.c (find_moveable_pseudos): Put back various analyses from ira()
	here.
	(ira): Move init_reg_equiv and call to
	split_live_ranges_for_shrink_wrap up, remove analyses around call
	to find_moveable_pseudos.

testsuite/
	* gcc.target/i386/pr59099.c: New test.

From-SVN: r205061
parent 8ce616e2
2013-11-19 Martin Jambor <mjambor@suse.cz>
PR rtl-optimization/59099
* ira.c (find_moveable_pseudos): Put back various analyses from ira()
here.
(ira): Move init_reg_equiv and call to
split_live_ranges_for_shrink_wrap up, remove analyses around call
to find_moveable_pseudos.
2013-11-20 Alan Modra <amodra@gmail.com>
* config/rs6000/sysv4.h (CC1_ENDIAN_LITTLE_SPEC): Define as empty.
......@@ -4522,6 +4522,9 @@ find_moveable_pseudos (void)
pseudo_replaced_reg.release ();
pseudo_replaced_reg.safe_grow_cleared (max_regs);
df_analyze ();
calculate_dominance_info (CDI_DOMINATORS);
i = 0;
bitmap_initialize (&live, 0);
bitmap_initialize (&used, 0);
......@@ -4834,6 +4837,14 @@ find_moveable_pseudos (void)
free (bb_moveable_reg_sets);
last_moveable_pseudo = max_reg_num ();
fix_reg_equiv_init ();
expand_reg_info ();
regstat_free_n_sets_and_refs ();
regstat_free_ri ();
regstat_init_n_sets_and_refs ();
regstat_compute_ri ();
free_dominance_info (CDI_DOMINATORS);
}
......@@ -5194,7 +5205,19 @@ ira (FILE *f)
#endif
df_analyze ();
init_reg_equiv ();
if (ira_conflicts_p)
{
calculate_dominance_info (CDI_DOMINATORS);
if (split_live_ranges_for_shrink_wrap ())
df_analyze ();
free_dominance_info (CDI_DOMINATORS);
}
df_clear_flags (DF_NO_INSN_RESCAN);
regstat_init_n_sets_and_refs ();
regstat_compute_ri ();
......@@ -5212,7 +5235,6 @@ ira (FILE *f)
if (resize_reg_info () && flag_ira_loop_pressure)
ira_set_pseudo_classes (true, ira_dump_file);
init_reg_equiv ();
rebuild_p = update_equiv_regs ();
setup_reg_equiv ();
setup_reg_equiv_init ();
......@@ -5235,22 +5257,7 @@ ira (FILE *f)
allocation because of -O0 usage or because the function is too
big. */
if (ira_conflicts_p)
{
df_analyze ();
calculate_dominance_info (CDI_DOMINATORS);
find_moveable_pseudos ();
if (split_live_ranges_for_shrink_wrap ())
df_analyze ();
fix_reg_equiv_init ();
expand_reg_info ();
regstat_free_n_sets_and_refs ();
regstat_free_ri ();
regstat_init_n_sets_and_refs ();
regstat_compute_ri ();
free_dominance_info (CDI_DOMINATORS);
}
find_moveable_pseudos ();
max_regno_before_ira = max_reg_num ();
ira_setup_eliminable_regset (true);
......
2013-11-19 Martin Jambor <mjambor@suse.cz>
PR rtl-optimization/59099
* gcc.target/i386/pr59099.c: New test.
2013-11-19 Sriraman Tallam <tmsriram@google.com>
* gcc.dg/tree-prof/cold_partition_label.c: New testcase.
......
/* { dg-do run } */
/* { dg-options "-O2 -fPIC -m32" } */
void (*pfn)(void);
struct s
{
void** q;
int h;
int t;
int s;
};
void* f (struct s *, struct s *) __attribute__ ((noinline, regparm(1)));
void*
__attribute__ ((regparm(1)))
f (struct s *p, struct s *p2)
{
void *gp, *gp1;
int t, h, s, t2, h2, c, i;
if (p2->h == p2->t)
return 0;
(*pfn) ();
h = p->h;
t = p->t;
s = p->s;
h2 = p2->h;
t2 = p2->t;
gp = p2->q[h2++];
c = (t2 - h2) / 2;
for (i = 0; i != c; i++)
{
if (t == h || (h == 0 && t == s - 1))
break;
gp1 = p2->q[h2++];
p->q[t++] = gp1;
if (t == s)
t = 0;
}
p2->h = h2;
return gp;
}
static void gn () { }
int
main()
{
struct s s1, s2;
void *q[10];
pfn = gn;
s1.q = q;
s1.h = 0;
s1.t = 2;
s1.s = 4;
s2.q = q;
s2.h = 0;
s2.t = 4;
s2.s = 2;
f (&s1, &s2);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment