[flang-commits] [flang] [flang] allow rebox/embox of OPTIONAL (PR #194319)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Mon Apr 27 03:14:56 PDT 2026


================
@@ -55,6 +57,40 @@ static void populateShift(llvm::SmallVectorImpl<mlir::Value> &vec,
   vec.append(shift.getOrigins().begin(), shift.getOrigins().end());
 }
 
+// Helper to emit embox/rebox for OPTIONAL input inside a block
+// guarded by a runtime presence check and to return an absent
+// box when the input is not present.
----------------
tblah wrote:

What is the difference between a box with a null address saved into it, and the box from fir.absent? As this is so late in the pipeline maybe we don't need an if at all?

https://github.com/llvm/llvm-project/pull/194319


More information about the flang-commits mailing list