Process only valid shift ranges.
authorAndrew MacLeod <amacleod@redhat.com>
Thu, 19 Nov 2020 22:41:30 +0000 (17:41 -0500)
committerAndrew MacLeod <amacleod@redhat.com>
Thu, 19 Nov 2020 22:41:30 +0000 (17:41 -0500)
commitd0d8b5d83614d8f0d0e40c0520d4f40ffa01f8d9
treeb3e41b7114dececa7aad5faf4b314771673d2b2a
parent5bba2215c23d71ea08fb81656d93041229f7ea9c
Process only valid shift ranges.

When shifting outside the valid range of [0, precision-1], we can
choose to process just the valid ones since the rest is undefined.
this allows us to produce results for x << [0,2][+INF, +INF] by discarding
the invalid ranges and processing just [0,2].

gcc/
PR tree-optimization/93781
* range-op.cc (get_shift_range): Rename from
undefined_shift_range_check and now return valid shift ranges.
(operator_lshift::fold_range): Use result from get_shift_range.
(operator_rshift::fold_range): Ditto.
gcc/testsuite/
* gcc.dg/tree-ssa/pr93781-1.c: New.
* gcc.dg/tree-ssa/pr93781-2.c: New.
* gcc.dg/tree-ssa/pr93781-3.c: New.
gcc/range-op.cc
gcc/testsuite/gcc.dg/tree-ssa/pr93781-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr93781-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr93781-3.c [new file with mode: 0644]