https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95801

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
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<d, 0>, 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.

Reply via email to