[flang-commits] [flang] [llvm] [flang][MIF] Adding lowering for EVENT POST/WAIT statements (PR #210283)
via flang-commits
flang-commits at lists.llvm.org
Tue Sep 8 02:56:46 PDT 2026
================
@@ -213,6 +243,93 @@ static mlir::Value getSizeInBytes(fir::FirOpBuilder &builder,
return sizeInBytes;
}
+/// Compute an offset in bytes from the beginning of the elements provided in
+/// "val". Basically, if it is not a memory access operation for an array such
+/// as fir::ArrayCoorOp or fir::CoordinateOp, then the element's offset is zero.
+static mlir::Value
+computeOffsetInBytes(fir::FirOpBuilder &builder, mlir::Location loc,
----------------
jeanPerier wrote:
I think this will be brittle in the long run (will break when FIR addressing IR evolves).
I would suggest having an operation of the form mif.event_post coarray, [cosubscripts], [suboject]
where in something like `coarray[peer]%comp%event` suboject is `coarray%comp%event`
That way you can compute offset via pointer arithmetic from the base addresses ``coarray%comp%event - coarray` and you do not need to "reverse engineer"/pattern match the FIR addressing IR (which is acceptable in optimization where failure is an option, but is risky/brittle here).
https://github.com/llvm/llvm-project/pull/210283
More information about the flang-commits
mailing list