[Bug tree-optimization/47004] missed optimization in length comparison

2021-08-30 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47004

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=102138

--- Comment #4 from Andrew Pinski  ---
Note we don;t optimize at -O1 yet, that is PR 102138.


With this code:
int g(); int h();

int lenzero1(int f, int l) {
 if ( len(f, l) == 0)
   return g();
  return h();
}
We can optimize this one at -O1 since GCC 8 with DOM optimizing it out the
second conditional (I did not look to see what fixed it though).

[Bug tree-optimization/47004] missed optimization in length comparison

2021-08-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47004

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
   Target Milestone|--- |5.0
   Keywords||missed-optimization
  Known to work||5.1.0
 Status|NEW |RESOLVED
  Known to fail||4.9.4

--- Comment #3 from Andrew Pinski  ---
Fixed for GCC 5 by r5-3799.


We get a VRP range now of:
_4: [0, +INF(OVF)]


For:
  if (f_2(D) <= l_3(D))
goto ;
  else
goto ;

  :
  _4 = l_3(D) - f_2(D);
Which is exactly as we had expected.

[Bug tree-optimization/47004] missed optimization in length comparison

2010-12-19 Thread ebotcazou at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47004

Eric Botcazou ebotcazou at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2010.12.19 08:55:31
 CC||ebotcazou at gcc dot
   ||gnu.org
Version|4.5.4   |4.6.0
Summary|missed optimization in  |missed optimization in
   |comparison  |length comparison
 Ever Confirmed|0   |1
   Severity|minor   |enhancement

--- Comment #2 from Eric Botcazou ebotcazou at gcc dot gnu.org 2010-12-19 
08:55:31 UTC ---
Still visible on the mainline.  Maybe this could help other languages as well.