[flang-commits] [flang] [flang] Lower non optional inquired argument in custom intrinsic lowering (PR #93592)

via flang-commits flang-commits at lists.llvm.org
Wed May 29 02:37:19 PDT 2024


================
@@ -2486,12 +2487,34 @@ IntrinsicLibrary::genAssociated(mlir::Type resultType,
     // In both cases, ASSOCIATED should be false if POINTER is NULL.
     return builder.create<mlir::arith::AndIOp>(loc, sameTarget, notNull);
   }
+
+  const fir::ExtendedValue &target = args[1];
+
+  if (!args[0].getBoxOf<fir::MutableBoxValue>()) {
----------------
jeanPerier wrote:

I would not expect any change here. IntrinsicCall.cpp should not depend on HLFIR.
Usually, these kind of issues are packaging issues related to the mlir::Value to fir::ExtendedValue implicit ctor.

Here, I suspect you need to change `getArgument` https://github.com/llvm/llvm-project/blob/a72a90677d2b320e3bca553698e99143034387d9/flang/lib/Lower/ConvertCall.cpp#L1793 to `return Fortran::lower::translateToExtendedValue(loc, builder, actual, callContext.stmtCtx);` to get the correct packaging. My bad, I wrote it with simple scalars in mind...

Then, you should not need any changes in both IntrinsicCall.cpp and CustomIntrinsicCall.cpp.

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


More information about the flang-commits mailing list