llvm-project
a3e84fb1 - [flang][CodeGen] Lower undefined fir.box to descriptor storage (#240439)

Commit
3 days ago
[flang][CodeGen] Lower undefined fir.box to descriptor storage (#240439) A fir.box SSA value is lowered as the address of its descriptor storage, and fir.load/fir.store of a box are lowered as memcpy through that address. fir.undefined of a box type was lowered to an undefined pointer, so storing or loading a possibly undefined box (for instance a box merged with the fir.undefined default value that MLIR mem2reg inserts when promoting a fir.alloca of a box) copied from an undefined address. Optimized code usually drops such copies, but unoptimized code reads from address zero. Lower fir.undefined of a box type to an uninitialized descriptor alloca so that these copies are well defined. For assumed-rank boxes, whose copy size is computed from the rank field, also set the rank to zero so that the copy stays within the storage.
Author
Parents
Loading