[flang][hlfir] Use the HLFIR base of hlfir.declare if possible.
This patch makes use of the HLFIR box produced for hlfir.declare in place of the FIR box (the memref of hlfir.declare) when possible. This makes the representation a little bit more clear, because all accesses are made via a single box. This reduces the life range of the original box, because the new temporary box produced by embox/rebox is used from now. Apparently, this works around some issues in the current HLFIR codegen, for example, look at the LIT tests changes around fir.array_coor produced by hlfir.designate codegen - using the FIR box for fir.array_coor might result in using incorrect lbounds. Apparently, this change enables more intrinsics simplifications because the SimplifyIntrinsicsPass looks for explicit embox/rebox in findBoxDef() to decide whether to apply the optimization. This change also provides better association of the base addresses referenced by OpenACC clauses with the corresponding boxes that might be used explicitly in OpenACC regions (e.g. for reading the lbounds). Reviewed By: razvanlupusoru, clementval Differential Revision: https://reviews.llvm.org/D158119
Loading
Please sign in to comment