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

via flang-commits flang-commits at lists.llvm.org
Tue Mar 25 04:12:21 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:

Propagate it sounds useful for this op.

Keep in mind that in general propagating all attributes from one operation to another can have funny effect if both implement things like the `AttrSizedOperandSegments` and you end-up overriding the attribute segment size from the new op with the one from the old op that may be totally unrelated (this array attribute helps MLIR keeping track of operands for operation with several variadic arguments).

However, this is not the case for llvm.load, fir.store which are simple ops, so propagating the attribute seems OK/useful.

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


More information about the flang-commits mailing list