This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] live analysis on local static functions


In message <1066149766.10504.1982.camel@p4>, Andrew MacLeod writes:
 >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:
But it still seems to me that something is missing the fact that "a"
is actually used.  If "a" is marked as used, then everything ought to
work as expected.

A static variable which is never used really should go away, even if it
has an initializer since it contributes nothing to observable behavior of
the program.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]