[flang-commits] [flang] [flang][Lower] Add lowering to SYNC ALL, SYNC MEMORY and SYNC IMAGES to PRIF (PR #154166)
Katherine Rasmussen via flang-commits
flang-commits at lists.llvm.org
Sun Aug 24 21:34:56 PDT 2025
================
@@ -48,6 +49,41 @@ static void genUnreachable(fir::FirOpBuilder &builder, mlir::Location loc) {
builder.setInsertionPointToStart(newBlock);
}
+/// Initializes values for STAT and ERRMSG
+static std::pair<mlir::Value, mlir::Value> getStatAndErrmsg(
+ Fortran::lower::AbstractConverter &converter, mlir::Location loc,
+ const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList) {
+ fir::FirOpBuilder &builder = converter.getFirOpBuilder();
+ Fortran::lower::StatementContext stmtCtx;
+
+ mlir::Value errMsgExpr, statExpr;
+ for (const Fortran::parser::StatOrErrmsg &statOrErr : statOrErrList) {
+ std::visit(Fortran::common::visitors{
+ [&](const Fortran::parser::StatVariable &statVar) {
+ statExpr = fir::getBase(converter.genExprAddr(
+ loc, Fortran::semantics::GetExpr(statVar), stmtCtx));
+ },
+ [&](const Fortran::parser::MsgVariable &errMsgVar) {
+ const Fortran::semantics::SomeExpr *expr =
+ Fortran::semantics::GetExpr(errMsgVar);
+ errMsgExpr = fir::getBase(
+ converter.genExprBox(loc, *expr, stmtCtx));
+ }},
+ statOrErr.u);
+ }
+
+ if (!statExpr) {
+ statExpr = builder.create<fir::AbsentOp>(
----------------
ktras wrote:
Thank you for addressing @clementval's comment about the deprecation of `builder.create` by replacing those calls for `CallOp`. However, his comment also mentions
> This applies for all `builder.create<OpTy>`
Thus, I believe that calls like the one on this line should also be changed to using `fir::AbsentOp::create`.
https://github.com/llvm/llvm-project/pull/154166
More information about the flang-commits
mailing list