[flang] Make a descriptor copy for fir.load fir.ref<fir.box>
`fir.box` and `fir.ref<fir.box>` are both lowered to LLVM as a descriptor in memory. This is because fir.box of polymorphic and assumed rank entities cannot be known at compile time, so fir.box cannot be lowered to a struct value. fir.load or fir.ref<fir.box> was previously lowered to a no-op, propagating the operand descriptor storage as a result. This is wrong because the operand descriptor storage may later be modified, and these changes should not be visible in the loaded fir.box that is an immutable SSA value. Modify fir.load codegen for fir.box to make a copy into a new storage to ensure the fir.box is immutable. Differential Revision: https://reviews.llvm.org/D133779
Loading
Please sign in to comment