@@ -3282,16 +3282,21 @@ class FirConverter : public Fortran::lower::AbstractConverter {
32823282 Fortran::lower::SomeExpr expr{*ea.Analyze (
32833283 std::get<Fortran::parser::DataRef>(p.value ().u ))};
32843284 Fortran::lower::StatementContext stmtCtx;
3285+ mlir::Location loc = genLocation (dir.source );
32853286 mlir::Value memRef{Fortran::lower::convertExprToHLFIR (
3286- genLocation (dir.source ), *this , expr,
3287- localSymbols, stmtCtx)
3287+ loc, *this , expr, localSymbols, stmtCtx)
32883288 .getBase ()};
3289+ if (mlir::isa<fir::BaseBoxType>(
3290+ fir::unwrapRefType (memRef.getType ()))) {
3291+ memRef = fir::LoadOp::create (*builder, loc, memRef);
3292+ memRef = fir::BoxAddrOp::create (*builder, loc, memRef);
3293+ }
32893294
32903295 // TODO: Don't use default value, instead get the following
32913296 // info from the directive
32923297 uint32_t isWrite{0 }, localityHint{3 }, isData{1 };
3293- fir::PrefetchOp::create (*builder, genLocation (dir. source ) ,
3294- memRef, isWrite, localityHint, isData);
3298+ fir::PrefetchOp::create (*builder, loc, memRef, isWrite ,
3299+ localityHint, isData);
32953300 }
32963301 },
32973302 [&](const auto &) {}},
0 commit comments