Add wi_fold_in_parts.
authorAndrew MacLeod <amacleod@redhat.com>
Fri, 16 Jul 2021 15:42:14 +0000 (11:42 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Sat, 17 Jul 2021 00:27:10 +0000 (20:27 -0400)
commit704e8a825c78b9a8424c291509413bbb48e602c7
tree8f2b7e49da176c3ec9af9b0124e45dda8e1dca1b
parent87277b6a04486b606761b86dbcfbc9a4b6871f4c
Add wi_fold_in_parts.

range-ops uses wi_fold to individually fold subranges one at a time and
then combined them.  This patch first calls wi_fold_in_parts which checks if
one of the subranges is small, and if so, further splits that subrange
into constants.

gcc/
PR tree-optimization/96542
* range-op.cc (range_operator::wi_fold_in_parts): New.
(range_operator::fold_range): Call wi_fold_in_parts.
(operator_lshift::wi_fold): Fix broken lshift by [0,0].
* range-op.h (wi_fold_in_parts): Add prototype.

gcc/testsuite
* gcc.dg/pr96542.c: New.
gcc/range-op.cc
gcc/range-op.h
gcc/testsuite/gcc.dg/pr96542.c [new file with mode: 0644]