[Bug tree-optimization/66299] more optimize oppotunity

2015-05-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66299

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
   Target Milestone|--- |6.0


[Bug tree-optimization/66299] more optimize oppotunity

2015-05-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66299

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #4 from Marek Polacek mpolacek at gcc dot gnu.org ---
I have some patch now, we'll see.

There are some more things to optimize, e.g. if ((1  x) == 3) can't ever be
true, yet we fail to optimize it to if (0).


[Bug tree-optimization/66299] more optimize oppotunity

2015-05-27 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66299

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-05-27
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #3 from Marek Polacek mpolacek at gcc dot gnu.org ---
Confirmed.  I'm experimenting with this.


[Bug tree-optimization/66299] more optimize oppotunity

2015-05-27 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66299

--- Comment #1 from Andrew Pinski pinskia at gcc dot gnu.org ---
1x == 2 can be transformed into x == 1 and that seems like it is not being
done.

Related to bug 15350.


[Bug tree-optimization/66299] more optimize oppotunity

2015-05-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66299

--- Comment #2 from Jakub Jelinek jakub at gcc dot gnu.org ---
I'd think using a volatile var in the optimization test is highly undesirable,
that can mean stopping optimizations differently between different compilers.
But, the same thing can be reproduced with:
void
foo (signed int x)
{
  unsigned int t = ((unsigned int) 1U  x);

  if (t != 2U)
__builtin_abort ();
}

Perhaps we should have a match.pd simplification of (const1  var) {==,!=}
const2, perhaps something even for {,=,,=} if they could be simplified to a
simple comparison of var and const3; supposedly guarded with single use of the
shift.  What about  ?  Other arithmetics single use operations (e.g. 2U * var
== 16)?  For addition of a constant apparently forwprop1 already optimizes
that.