[flang-commits] [flang] [mlir] [flang][openacc][openmp] Support implicit casting on the atomic interface (PR #114390)

via flang-commits flang-commits at lists.llvm.org
Mon Nov 4 11:40:19 PST 2024


================
@@ -411,12 +417,22 @@ void genOmpAccAtomicRead(Fortran::lower::AbstractConverter &converter,
   mlir::Value toAddress = fir::getBase(converter.genExprAddr(
       *Fortran::semantics::GetExpr(assignmentStmtVariable), stmtCtx));
   fir::FirOpBuilder &builder = converter.getFirOpBuilder();
-  if (fromAddress.getType() != toAddress.getType())
-    fromAddress =
-        builder.create<fir::ConvertOp>(loc, toAddress.getType(), fromAddress);
-  genOmpAccAtomicCaptureStatement(converter, fromAddress, toAddress,
+  mlir::Value LHSTemp = toAddress;
+  if (fromAddress.getType() != toAddress.getType()) {
+    // Create a temp for implicit type conversion.
+    LHSTemp = builder.create<fir::AllocaOp>(
----------------
khaki3 wrote:

Thank you for your comment. I tried `createTemporary` in the FIR builder. But that caused an issue in the operation walk.  Maybe I could take a different approach. This line was already deleted in the latest change.

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


More information about the flang-commits mailing list