Cleanup irange::set.
authorAldy Hernandez <aldyh@redhat.com>
Mon, 9 Nov 2020 12:12:55 +0000 (13:12 +0100)
committerAldy Hernandez <aldyh@redhat.com>
Mon, 9 Nov 2020 14:42:10 +0000 (15:42 +0100)
commit4e85ad79a137535393d8dc169359e1730cab3533
tree807f1f89053079a2680caf8d8695fe292bac0282
parentfa59c8dcd2f97c929150bd32bae1f341e0d7b0f7
Cleanup irange::set.

[This is actually part of a larger patch that actually changes
behavior, but I thought I'd commit the non-invasive cleanups first
which will simplify the upcoming work.]

irange::set was doing more work than it should for legacy ranges.
I cleaned up various unnecessary calls to swap_out_of_order_endpoints,
as well as some duplicate code that could be done with normalize_min_max.

I also removed an obsolete comment wrt sticky infinite overflows.
Not only did the -INF/+INF(OVF) code get removed in 2017,
but normalize_min_max() uses wide ints, which ignored overflows
altogether.

gcc/ChangeLog:

* value-range.cc (irange::swap_out_of_order_endpoints): Rewrite
into static function.
(irange::set): Cleanup redundant manipulations.
* value-range.h (irange::normalize_min_max): Modify object
in-place instead of modifying arguments.
gcc/value-range.cc
gcc/value-range.h