------- Comment #5 from rguenth at gcc dot gnu dot org  2006-05-08 09:42 -------
This is really a PRE problem, much like the simplified testcase

char firstchar (const char *s)
{
        if (!s)
                s = "";
        return s[0];
}

where it could record the fact that the load from s[0] is available as
is strlen(s).  Now, if it is worth it is another question.

Danny, will the new VN do anything about this, or make it easier to tackle
this problem?  Now, ccp has moved the assignment into a PHI node, which may
make this more complicated (this is after PRE):

mystrlen (s)
{
  size_t D.1648;

<bb 2>:
  if (s_2 == 0B) goto <L4>; else goto <L3>;

<L4>:;
  goto <bb 4> (<L1>);

<L3>:;

  # s_1 = PHI <s_2(3), &""[0](5)>;
<L1>:;
  #   VUSE <SMT.4_6>;
  D.1648_3 = strlen (s_1);
  return D.1648_3;

}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dberlin at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3511

Reply via email to