[flang-commits] [flang] [llvm] [Flang][OpenMP] Generate correct present checks for implicit maps of optional allocatables (PR #138210)

via flang-commits flang-commits at lists.llvm.org
Mon May 5 08:56:33 PDT 2025


================
@@ -156,9 +156,9 @@ genBoundsOpsFromBox(fir::FirOpBuilder &builder, mlir::Location loc,
         builder.genIfOp(loc, resTypes, info.isPresent, /*withElseRegion=*/true)
             .genThen([&]() {
               mlir::Value box =
-                  !fir::isBoxAddress(info.addr.getType())
+                  !fir::isBoxAddress(info.rawInput.getType())
                       ? info.addr
-                      : builder.create<fir::LoadOp>(loc, info.addr);
+                      : builder.create<fir::LoadOp>(loc, info.rawInput);
----------------
jeanPerier wrote:

Why is the change from addr to rawInput needed here?

I am asking because I am considering removing the hlfir.declare second result as an IR design simplification, since it should be possible to get anything starting from the first result, and I see that rawInput is specifically set to be the second result [here](https://github.com/llvm/llvm-project/blob/82387ec13258f67a530ddb615a49e0f36e8575e1/flang/include/flang/Optimizer/Builder/DirectivesCommon.h#L63).

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


More information about the flang-commits mailing list