[flang] add hlfir.null to implement NULL()
In HLFIR, the address of a Fortran entity in lowering must be defined by an operation that has the FortranVariableOpInterface (it is a sanity requirement to ensure that the mlir::Value propagated in certain places of lowering can be reasoned about). fir.zero_bits does not have this interface and it makes little sense to add it since it can "zero initialize" more types than just addresses. Creating an hlfir.declare for null addresses is a bit too much (what would be the name), and it would be noisy in the IR. Instead add a small hlfir.null operation whose codegen is simply a replacement by fir.zero_bits. It may also later help dealing with the NULL(MOLD) cases in a nicer way (the current lowering of this uses special handling it). Differential Revision: https://reviews.llvm.org/D141040
Loading
Please sign in to comment