The patch is mostly fine, although you probably want to change the condition to check for a non-null stmt as well... ie

-   if (subcode == MINUS_EXPR)
+  if (s && subcode == MINUS_EXPR)

because it looks like the stmt defaults to NULL and I suspect the relation query will trap if S is null.

I defer to the release managers about whether it goes in trunk now or stage 1 :-)

Andrew

On 2/11/25 19:20, Jeff Law wrote:
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.

OK for the trunk?

Jeff

Reply via email to