This is the mail archive of the gcc-patches@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: [PATCH] Allow tree-ssa Forward Prop to produce VIEW_CONVERT_EXPR in some cases


On Mon, May 5, 2008 at 9:56 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Mon, May 5, 2008 at 6:40 AM, Andrew Pinski <pinskia@gmail.com> wrote:
>  > On Fri, May 2, 2008 at 4:12 AM, Andrew Pinski <pinskia@gmail.com> wrote:
>  >  >  Hmm, yes to both the above.  Guess I have to look more into this than
>  >  >  just that.  I will add both of these testcases.
>  >
>  >  So there was a change between 4.1.1 and the trunk I did not notice
>  >  until now which caused volatile checks needed to be added.  Before in
>  >  4.1.1, we used to not look at volatile use statements but now on the
>  >  trunk we do.
>  >
>  >
>  >  >  >  Also if you cannot use fold_build1 because of the invalid gimple issue,
>  >  >  >  won't you run into this problem with fold_stmt as well?
>  >  >
>  >  >  For some reason fold_stmt does not change it, I think it tries but
>  >  >  rejects it as invalid gimple.
>  >
>  >  Here is the new patch which fixes all three problems; we also fold the
>  >  VCE now and regimplify the statement when needed.
>  >
>  >
>  >  OK? Bootstrapped and tested on i686-linux-gnu with no regressions.
>
>  This is ok for trunk.  Please have an eye on possible fallouts (we'll now create
>  a V_C_E if we get trees with wrong types rather than not doing the substitution
>  in some cases).

forwprop now transforms

  const char * p;
  char buf[1];
  char D.1563;
  p_2 = &buf;
  # VUSE <buf_11>
  D.1563_4 = *p_2;

into

  D.1563_4 = VIEW_CONVERT_EXPR<const char>(buf);

which is not good.  (this is the &buf vs. &buf[0] problem I guess)
Before your change forwprop wouldn't have touched the above
(ccp does the right thing here).  I guess &buf doesn't get canonicalized
by the gimplifier as the cast to (const char *) is stripped as useless.

Testcase is gcc.dg/tree-ssa/pr24689.c with -fno-tree-ccp.  (I noticed
this when re-ordering passes)

Richard.


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