[COMMITTED] PR tree-optimization/103079 - Treat undefined operands as varying in GORI.

Andrew MacLeod amacleod@redhat.com
Thu Nov 4 17:27:25 GMT 2021

Outgoing range calculations were assuming an undefined operand produces 
an undefined result.  This is not true, as in the testcxase:

   [0, 0]  = UNDEFINED | b_9     tells us that b_9 is [0,0] and the rest 
of the time, we only know its varying.    Returning UNDEFINED for b_9 is 
clearly wrong.

This patch turns any UNDEFINED values for op1 and op2 into VARYING, and 
then invokes the calcualtion, so instead, we';ll know see:

  [0, 0] = VARYING | b_9   which the solvers will correctly pick the 
right range.

Furthermore, we were always returning UNDEFINED when the LHS is 
undefined... ie.

UNDEFINED = 1 | b_9   was returning UNDEFINED for b_9...  even tho the 
LHS is undefined, it seems to be asking for trouble to continue 
calculating an outgoing range for b_9, so instead we just stop looking now.

Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 79.diff
Type: text/x-patch
Size: 3787 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211104/d4941cd0/attachment.bin>

More information about the Gcc-patches mailing list