Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PR tree-optimization/98028] Use relationship between operands to sim…
…plify SUB_OVERFLOW So this is a fairly old regression, but with all the ranger work that's been done, it's become easy to resolve. The basic idea here is to use known relationships between two operands of a SUB_OVERFLOW IFN to statically compute the overflow state and ultimately allow turning the IFN into simple arithmetic (or for the tests in this BZ elide the arithmetic entirely). The regression example is when the two inputs are known equal. In that case the subtraction will never overflow. But there's a few other cases we can handle as well. a == b -> never overflows a > b -> never overflows when A and B are unsigned a >= b -> never overflows when A and B are unsigned a < b -> always overflows when A and B are unsigned Bootstrapped and regression tested on x86, and regression tested on the usual cross platforms. This is Jakub's version of the vr-values.cc fix rather than Jeff's. PR tree-optimization/98028 gcc/ * vr-values.cc (check_for_binary_op_overflow): Try to use a known relationship betwen op0/op1 to statically determine overflow state. gcc/testsuite * gcc.dg/tree-ssa/pr98028.c: New test.
- Loading branch information