[flang] Fold more reduction intrinsic function calls
authorpeter klausler <pklausler@nvidia.com>
Fri, 18 Jun 2021 18:24:32 +0000 (11:24 -0700)
committerpeter klausler <pklausler@nvidia.com>
Mon, 21 Jun 2021 17:13:59 +0000 (10:13 -0700)
commit503c085e3bcd0a031a363ee89c91b1f1e41bfa4b
treeb9775d9e68ed14b20e44ed8318c0598bcccbc3ad
parent60d97fb4cfa6164919f5ef5222b2afdd0ee04b1c
[flang] Fold more reduction intrinsic function calls

Refactor the recently-implemented MAXVAL/MINVAL folding so
that the parts that can be used to implement other reduction
transformational intrinsic function folding are exposed.

Use them to implement folding of IALL, IANY, IPARITY,
SUM. and PRODUCT.  Replace the folding of ALL & ANY to
use the new infrastructure and become able to handle DIM=
arguments.

Differential Revision: https://reviews.llvm.org/D104562
flang/include/flang/Evaluate/real.h
flang/lib/Evaluate/fold-character.cpp
flang/lib/Evaluate/fold-complex.cpp
flang/lib/Evaluate/fold-integer.cpp
flang/lib/Evaluate/fold-logical.cpp
flang/lib/Evaluate/fold-real.cpp
flang/lib/Evaluate/fold-reduction.h
flang/test/Evaluate/folding20.f90