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

Asher Mancinelli via flang-commits flang-commits at lists.llvm.org
Mon Mar 24 11:26:55 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?
----------------
ashermancinelli wrote:

It should be easy enough to pass the attributes through and conditionally set the volatile attribute after as Slava suggests, this way we know we don't lose anything. I'll update this.

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


More information about the flang-commits mailing list