[flang-commits] [flang] [flang][hlfir] Return function call result as AsExpr. (PR #67769)

via flang-commits flang-commits at lists.llvm.org
Fri Sep 29 06:40:54 PDT 2023


================
@@ -171,8 +171,11 @@ struct AsExprOpConversion : public mlir::OpConversionPattern<hlfir::AsExprOp> {
     fir::FirOpBuilder builder(rewriter, module);
     if (asExpr.isMove()) {
       // Move variable storage for the hlfir.expr buffer.
+      hlfir::Entity varEntity = hlfir::Entity{adaptor.getVar()};
+      varEntity = hlfir::derefPointersAndAllocatables(loc, builder, varEntity);
----------------
jeanPerier wrote:

Can the deref be moved in lowering?

The problem I see is that we will have some trouble explaining the read effect of AsExpr when it is operating on pointer/allocatables (since it will both be reading the descriptor and its target, but we do not have a value for the target to create a proper mlir::MemoryEffects::Read when asked getEffects).

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


More information about the flang-commits mailing list