* Fix usage of .GLOBAL_VAR
@ 2004-07-29 3:33 Diego Novillo
2004-07-29 6:09 ` Diego Novillo
0 siblings, 1 reply; 3+ messages in thread
From: Diego Novillo @ 2004-07-29 3:33 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Kenner
When .GLOBAL_VAR is created the first time, we add it as an alias of all
the call-clobbered variables in the program. However, the second time
we compute aliasing information, we not only don't create .GLOBAL_VAR
again, but we were clearing the may-alias sets of all the call-clobbered
variables and not restoring them.
This causes bootstrap problems with --param global-var-threshold=0 and
innumerable testsuite regressions due to bad code generation.
Kenner, unfortunately this fix does not seem related to the other Ada
failure I mentioned earlier today. Sorry.
Bootstrapped and tested x86, x86-64 and ppc.
Diego.
* tree-ssa-alias.c (maybe_create_global_var): Don't just
return if .GLOBAL_VAR has been created.
Index: tree-ssa-alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-alias.c,v
retrieving revision 2.19
diff -d -c -p -r2.19 tree-ssa-alias.c
*** tree-ssa-alias.c 28 Jul 2004 05:13:08 -0000 2.19
--- tree-ssa-alias.c 28 Jul 2004 17:53:35 -0000
*************** maybe_create_global_var (struct alias_in
*** 1492,1524 ****
size_t i, n_clobbered;
/* No need to create it, if we have one already. */
! if (global_var)
! return;
!
! /* Count all the call-clobbered variables. */
! n_clobbered = 0;
! EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, n_clobbered++);
! /* Create .GLOBAL_VAR if we have too many call-clobbered variables.
! We also create .GLOBAL_VAR when there no call-clobbered variables
! to prevent code motion transformations from re-arranging function
! calls that may have side effects. For instance,
! foo ()
{
int a = f ();
g ();
h (a);
}
! There are no call-clobbered variables in foo(), so it would be
! entirely possible for a pass to want to move the call to f()
! after the call to g(). If f() has side effects, that would be
! wrong. Creating .GLOBAL_VAR in this case will insert VDEFs for
! it and prevent such transformations. */
! if (n_clobbered == 0
! || ai->num_calls_found * n_clobbered >= (size_t) GLOBAL_VAR_THRESHOLD)
! create_global_var ();
/* If the function has calls to clobbering functions and .GLOBAL_VAR has
been created, make it an alias for all call-clobbered variables. */
--- 1492,1525 ----
size_t i, n_clobbered;
/* No need to create it, if we have one already. */
! if (global_var == NULL_TREE)
! {
! /* Count all the call-clobbered variables. */
! n_clobbered = 0;
! EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, n_clobbered++);
! /* Create .GLOBAL_VAR if we have too many call-clobbered
! variables. We also create .GLOBAL_VAR when there no
! call-clobbered variables to prevent code motion
! transformations from re-arranging function calls that may
! have side effects. For instance,
! foo ()
{
int a = f ();
g ();
h (a);
}
! There are no call-clobbered variables in foo(), so it would
! be entirely possible for a pass to want to move the call to
! f() after the call to g(). If f() has side effects, that
! would be wrong. Creating .GLOBAL_VAR in this case will
! insert VDEFs for it and prevent such transformations. */
! if (n_clobbered == 0
! || ai->num_calls_found * n_clobbered >= (size_t) GLOBAL_VAR_THRESHOLD)
! create_global_var ();
! }
/* If the function has calls to clobbering functions and .GLOBAL_VAR has
been created, make it an alias for all call-clobbered variables. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fix usage of .GLOBAL_VAR
2004-07-29 3:33 Fix usage of .GLOBAL_VAR Diego Novillo
@ 2004-07-29 6:09 ` Diego Novillo
0 siblings, 0 replies; 3+ messages in thread
From: Diego Novillo @ 2004-07-29 6:09 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Kenner
On Wed, 2004-07-28 at 14:30, Diego Novillo wrote:
> Bootstrapped and tested x86, x86-64 and ppc.
>
I forgot to add: bootstrapped with --param global-var-threshold=0.
Diego.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fix usage of .GLOBAL_VAR
@ 2004-07-29 8:47 Richard Kenner
0 siblings, 0 replies; 3+ messages in thread
From: Richard Kenner @ 2004-07-29 8:47 UTC (permalink / raw)
To: dnovillo; +Cc: gcc-patches
Kenner, unfortunately this fix does not seem related to the other Ada
failure I mentioned earlier today. Sorry.
I didn't think it was, but figured I might wait to be sure before
investing time into it.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-07-28 19:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-29 3:33 Fix usage of .GLOBAL_VAR Diego Novillo
2004-07-29 6:09 ` Diego Novillo
2004-07-29 8:47 Richard Kenner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).