[flang][hlfir] Apply component lower bounds in hlfir.designate codegen
authorJean Perier <jperier@nvidia.com>
Wed, 19 Apr 2023 07:00:51 +0000 (09:00 +0200)
committerJean Perier <jperier@nvidia.com>
Wed, 19 Apr 2023 07:01:37 +0000 (09:01 +0200)
commit752bd78f06d7db1af98a9ae41668b084874d7081
treef7ee07ad1a64541516a2b252b9380a7c718bdd23
parent3f4055dec4b52de857b21a90aa0006f5c07fbb32
[flang][hlfir] Apply component lower bounds in hlfir.designate codegen

The array component indices in the "path" of a fir.slice are zero based
because FIR does not know about the component lower bounds.
When lowering hlfir.designate to FIR for `array%x(i, j)`, convert `i` and
`j` to zero based indices before generating the fir.slice.

Differential Revision: https://reviews.llvm.org/D148627
flang/include/flang/Optimizer/Builder/HLFIRTools.h
flang/lib/Optimizer/Builder/HLFIRTools.cpp
flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
flang/test/HLFIR/designate-codegen-component-refs.fir