[flang-commits] [flang] [flang][rfc] Add represention of volatile references (PR #132486)

via flang-commits flang-commits at lists.llvm.org
Mon Mar 24 10:14:59 PDT 2025


================
@@ -3253,16 +3255,18 @@ struct LoadOpConversion : public fir::FIROpConversion<fir::LoadOp> {
       mlir::Value boxSize =
           computeBoxSize(loc, boxTypePair, inputBoxStorage, rewriter);
       auto memcpy = rewriter.create<mlir::LLVM::MemcpyOp>(
-          loc, newBoxStorage, inputBoxStorage, boxSize, /*isVolatile=*/false);
+          loc, newBoxStorage, inputBoxStorage, boxSize, isVolatile);
 
       if (std::optional<mlir::ArrayAttr> optionalTag = load.getTbaa())
         memcpy.setTBAATags(*optionalTag);
       else
         attachTBAATag(memcpy, boxTy, boxTy, nullptr);
       rewriter.replaceOp(load, newBoxStorage);
     } else {
+      // TODO: are we losing any attributes from the load op?
----------------
jeanPerier wrote:

I do not think though we are intentionally relying on something to be propagated here. As far as I can see, this was already in the "original" FIR codegen from 2020 ([here](https://github.com/flang-compiler/f18-llvm-project/blob/fir-dev.2/flang/lib/Optimizer/CodeGen.cpp#L1744)), so this may have been added without a precise use case in mind and with the assumption that we would be setting some LLVM attributes on fir.load.

I am not aware of pass-through usages, and there is no such thing on most of the FIR operation codegen. So I think it is OK to remove it.

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


More information about the flang-commits mailing list