[flang-commits] [flang] [flang] Handle procedure pointer and dummy procecure in REDUCE intrinsic calls (PR #95843)

via flang-commits flang-commits at lists.llvm.org
Tue Jun 18 03:24:00 PDT 2024


================
@@ -64,6 +88,10 @@ subroutine integer1(a, id)
 ! CHECK: %[[CONV_MASK:.*]] = fir.convert %[[BOXED_MASK]] : (!fir.box<!fir.array<3x!fir.logical<4>>>) -> !fir.box<none>
 ! CHECK: fir.call @_FortranAReduceInteger1Ref(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %[[CONV_MASK]], %{{.*}}, %false{{.*}})
 ! CHECK: fir.call @_FortranAReduceInteger1Value
+! CHECK: fir.call @_FortranAReduceInteger1Ref
+! CHECK: fir.call @_FortranAReduceInteger1Value
+! CHECK: fir.call @_FortranAReduceInteger1Ref
+! STILL NEED SOME WORK HERE fir.call @_FortranAReduceInteger1Value
----------------
jeanPerier wrote:

No, there is no way to get it from IntrinsicCall.cpp, it is not reflected anywhere in the IR currently (except when called). The reason we did that is that we anyway usually do not have the full signature for dummy procedure arguments that are mostly used in F77 without interface blocks, and they are called implicitly, so there was little point to bother typing it if it had to be converted on every call site anyway.

There are two solutions here:
- One is to change that and type the block arguments. May be better long term. Aside from the LIT tests fallout, there may be a few issues with the FIR to FIR passes that are changing function type like AbstractResult.cpp that may not properly visit and update block argument types, but they may have been solved when dealing with procedure pointers.
- The second is to intercept REDUCE in ConvertCall.cpp and do something special there using the front-end info about the procedure. 

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


More information about the flang-commits mailing list