On Fri, Nov 4, 2016 at 9:07 PM, Marc Glisse <marc.gli...@inria.fr> wrote: > Hello, > > since we were discussing this recently... > > The condition is copied from the existing 0 % X case, visible in the context > of the diff. > > As far as I understand, the main case where we do not want to optimize is > during constexpr evaluation in the C++ front-end (it wants to detect the > undefined behavior), and with late folding I think this means we only need > to care about an explicit 0/0, not about X/X where X would become 0 after > the simplification. > > And later, if we do have something like X/0, we could handle it the same way > as we currently handle *(char*)0, insert a trap after that instruction and > clear the following code, which likely gives better code than replacing 0/0 > with 1. > > Bootstrap+regtest on powerpc64le-unknown-linux-gnu.
Ok. Thanks, Richard. > 2016-11-07 Marc Glisse <marc.gli...@inria.fr> > > gcc/ > * match.pd (0 / X, X / X, X % X): New simplifications. > > gcc/testsuite/ > * gcc.dg/tree-ssa/divide-5.c: New file. > > -- > Marc Glisse