Saturate overflows return from SCEV in ranger.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 20 Oct 2020 13:25:20 +0000 (15:25 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Tue, 20 Oct 2020 15:23:12 +0000 (17:23 +0200)
commit5d53ec27015b916640171e891870adf2c6fdfd4c
treee40dddc65912a5f0727da9e19536a0c53948fea6
parentdbcc6b1577bedd2bf5879393c862b6c461787503
Saturate overflows return from SCEV in ranger.

bounds_of_var_in_loop is returning an overflowed int, which is causing
us to create a range for which we can't compare the bounds causing
an ICE in verify_range.

Overflowed bounds cause compare_values() to return -2, which we
don't handle in verify_range.

We don't represent overflowed ranges in irange, so this patch just
saturates any overflowed end-points to MIN or MAX.

gcc/ChangeLog:

PR tree-optimization/97501
* gimple-range.cc (gimple_ranger::range_of_ssa_name_with_loop_info):
Saturate overflows returned from SCEV.

gcc/testsuite/ChangeLog:

* gcc.dg/pr97501.c: New test.
gcc/gimple-range.cc
gcc/testsuite/gcc.dg/pr97501.c [new file with mode: 0644]