[tree-ssa] live analysis on local static functions
Jan Hubicka
jh@suse.cz
Tue Oct 14 16:52:00 GMT 2003
Hi,
I am looking into the problems with unit-at-a-time on tree-ssa branch.
The testcase I am running into can be reproduced even with
unit-at-a-time disabled and looks like:
static inline char * test()
{
static char *a="";
return a;
}
char * q()
{
return test();
}
The dump before last DCE pass is:
;; Function q (q)
q ()
{
char * <Ub244>;
char * retval.2;
char * T.1;
{
{
static char * a = (char *)"";
<Ub244>_2 = a;
goto <Ub1d0>;;
};
<Ub1d0>:;;
(void)0;
};
(void)0;
return <Ub244>_2;;
}
and after dce is
;; Function q (q)
q ()
{
char * <Ub244>;
{
<Ub244> = a;
<Ub1d0>:;;
};
return <Ub244>;;
}
so we miss the initializer. I've tracked down the problem to fact that
variable a does not have flag used set in it's annotation. It has, when
I disable the inlining. It is marked in create_ssa_var_map by seeing
VUSE attached to the return statement. With inline enabled the set also
has VUSE but it's operand is not VAR_DECL itself, but SSA_NAME
I am quite lost here. I am not sure how the liveness should work.
SHould the SSA_NAME match the expression in bind expr (as one would
expect for valid SSA form?)
Do we really want something like that? (the place of BIND_EXPR in the
CFG is quite missleading as everything is executed before the function
is done just once). What would be proper fix for that?
So far I can work around by disabling of removal of BIND_EXPRs for
static variables. This gets me further in the bootstrap.
Honza
More information about the Gcc
mailing list