[Bug tree-optimization/95801] Optimiser does not exploit the fact that an integer divisor cannot be zero

2025-05-20 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95801

Andrew Macleod  changed:

   What|Removed |Added

 CC||amacleod at redhat dot com
 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Andrew Macleod  ---
fixed on trunk.

[Bug tree-optimization/95801] Optimiser does not exploit the fact that an integer divisor cannot be zero

2025-04-28 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95801

--- Comment #5 from GCC Commits  ---
The master branch has been updated by Andrew Macleod :

https://gcc.gnu.org/g:9a467c2ceaa680a3b54a7bc20e6bb6c3f8a47004

commit r16-245-g9a467c2ceaa680a3b54a7bc20e6bb6c3f8a47004
Author: Andrew MacLeod 
Date:   Tue Jan 21 11:49:12 2025 -0500

Infer non-zero for integral division RHS.

Adding op2_range for operator_div allows ranger to notice the divisor
is non-zero after execution.

PR tree-optimization/95801
gcc/
* range-op.cc (operator_div::op2_range): New.

gcc/testsuite/
* gcc.dg/tree-ssa/pr95801.c: New.

[Bug tree-optimization/95801] Optimiser does not exploit the fact that an integer divisor cannot be zero

2025-02-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95801

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #4 from Andrew Pinski  ---
https://gcc.gnu.org/pipermail/gcc-patches/2025-January/674259.html

[Bug tree-optimization/95801] Optimiser does not exploit the fact that an integer divisor cannot be zero

2025-01-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95801

Andrew Pinski  changed:

   What|Removed |Added

 Blocks||85316
 Ever confirmed|0   |1
   Severity|normal  |enhancement
   Last reconfirmed||2025-01-09
 Status|UNCONFIRMED |NEW


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases

[Bug tree-optimization/95801] Optimiser does not exploit the fact that an integer divisor cannot be zero

2020-06-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95801

--- Comment #3 from Richard Biener  ---
Created attachment 48768
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48768&action=edit
prototype

Here is the WIP patch, work is suspended.  There may be a duplicate bug about
this.

[Bug tree-optimization/95801] Optimiser does not exploit the fact that an integer divisor cannot be zero

2020-06-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95801

--- Comment #2 from Richard Biener  ---
I have a patch exploiting this but it faces some correctness issues in the
propagators where some of them instantiate the assumptions before simplifying
the stmts themselves.

[Bug tree-optimization/95801] Optimiser does not exploit the fact that an integer divisor cannot be zero

2020-06-21 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95801

--- Comment #1 from Marc Glisse  ---
Except when dereferencing a pointer (?), gcc seldom uses an operation to derive
properties on the operands, it mostly derives properties on the result. That's
in large part because the information you are getting on the operands is only
valid in some regions, not for the whole life of the SSA_NAME (in if(y!=0)x/y;
the division obviously doesn't allow to remove the earlier test for y!=0)
There could be many cases:
x/y => y is not 0
i+1 => i is not INT_MAX
x/[ex]4 => the last 2 bits of x are 0
ptr+n or *ptr => ptr is not a null pointer

There is code in isolate-path to handle operands that are potentially 0, but I
think that's only when we see x / PHI, not for a "normal" divisor.

VRP works around the issue by creating extra SSA_NAMEs for the regions where we
know more about a variable, but it only does it for branches like if(x<10),
doing it for the operands of every operation would be too costly.