[flang] fix optional pointer TARGET argument lowering in ASSOCIATED
The TARGET argument of ASSOCIATED has a special lowering to deal with POINTER and ALLOCATABLE optional actual arguments because they may be dynamically absent. The previous code was doing a ternary (mlir::SelectOp) to deal with this case, but generated invalid code for the unused argument (loading a nullptr fir.ref<fir.box>). This was not detected until D133779 was merged and modified how fir.load are lowered to LLVM for fir.box types. Replace the select by a proper if to prevent the fir.load from being reachable in context where it should not. Differential Revision: https://reviews.llvm.org/D134174
Loading
Please sign in to comment