This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/37242] missed FRE opportunity because of signedness of addition



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-08-26 21:16 -------
>This could be due to array indexing lowered to POINTER_PLUS_EXPR.

Array indexing is never lowered using POINTER_PLUS_EXPR, only for pointers it
is.  Though it looks like
we are doing the math in unsigned in one case but signed in another but we
don't consider them the same for PRE.

Simple testcase:
int f(int a)
{
  unsigned b = a;
  b++;
  a++;
  return a + b;
}
We should just get return a*2 + 2; (which we do at the RTL level) but we get:
  b = (unsigned int) a;
  return (int) ((b + 1) + (unsigned int) (a + 1));


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-08-26 21:16:06
               date|                            |
            Summary|missed FRE opportunity      |missed FRE opportunity
                   |                            |because of signedness of
                   |                            |addition


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


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