[flang] Fix UBOUND() folding for constant arrays
authorMike Kashkarov <fruitclover@gmail.com>
Wed, 27 Apr 2022 13:14:10 +0000 (16:14 +0300)
committerMike Kashkarov <fruitclover@gmail.com>
Wed, 27 Apr 2022 16:17:47 +0000 (01:17 +0900)
commitd8b4ea486a5c152ba1ceb656a3d6638defe40fe1
tree271303e21996aa0f305efb1d44d584c20d91bfc8
parent88bc24a7e39ef3f85857c3d0857e0e5c93b50bbc
[flang] Fix UBOUND() folding for constant arrays

Similarly to LBOUND in https://reviews.llvm.org/D123237, fix UBOUND() folding
for constant arrays (for both w/ and w/o DIM=): convert
GetConstantArrayLboundHelper into common helper class for both lower/upper
bounds.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D123520
flang/include/flang/Evaluate/constant.h
flang/lib/Evaluate/constant.cpp
flang/lib/Evaluate/fold-integer.cpp
flang/test/Evaluate/folding08.f90