This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] live analysis on local static functions
- From: Andrew MacLeod <amacleod at redhat dot com>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc mailing list <gcc at gcc dot gnu dot org>, Diego Novillo <dnovillo at redhat dot com>, Richard Henderson <rth at redhat dot com>
- Date: 14 Oct 2003 12:42:45 -0400
- Subject: Re: [tree-ssa] live analysis on local static functions
- References: <20031014161010.GH6212@kam.mff.cuni.cz>
On Tue, 2003-10-14 at 12:10, Jan Hubicka wrote:
> 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 get out of ssa producing:
q ()
{
char * <U1244>;
char * retval.2;
char * T.1;
# BLOCK 0. PRED: -1. SUCC: 1.
{
{
static char * a = (char *)"";
# VUSE <a_1>;
<U1244> = a;
goto <U11d0>;;
};
# BLOCK 1. PRED: 0. SUCC: 2.
<U11d0>:;;
(void)0;
};
# BLOCK 2. PRED: 1. SUCC: -2.
(void)0;
return <U1244>;;
}
and then the call to remove useless crud produces the final, incorrect,
code of:
;; Function q (q)
q ()
{
char * <U1244>;
{
<U1244> = a;
<U11d0>:;;
};
return <U1244>;;
}
> 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.
I assume the useless stmt remover ought to check to see if there is a
static initializer in a BIND_EXPR before removing a DECL with an
initializer which is not marked used.
Either that, or has_hidden_use() ought to be set on A.
Neither is true right now.
There are other choices too :-)
Andrew
FOr instance, It does get fixed with:
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.173
diff -c -p -r1.1.4.173 tree-cfg.c
*** tree-cfg.c 6 Oct 2003 14:34:25 -0000 1.1.4.173
--- tree-cfg.c 14 Oct 2003 16:41:37 -0000
*************** remove_useless_stmts_and_vars_bind (tree
*** 1398,1403 ****
--- 1398,1404 ----
&& ! ann->used
&& ! ann->has_hidden_use
&& ! TREE_ADDRESSABLE (vars)
+ && ! (TREE_STATIC (vars) && DECL_INITIAL (vars) != 0)
&& (DECL_ARTIFICIAL (vars) || optimize >= 2))
{
/* Remove the variable from the BLOCK structures. */