[flang-commits] [flang] [flang][rfc] Add represention of volatile references (PR #132486)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Mon Mar 24 09:24:36 PDT 2025
================
@@ -37,6 +37,15 @@ namespace {
#include "flang/Optimizer/Dialect/CanonicalizationPatterns.inc"
} // namespace
+static void addVolatileMemoryEffects(
+ mlir::Type type, llvm::SmallVectorImpl<mlir::SideEffects::EffectInstance<
+ mlir::MemoryEffects::Effect>> &effects) {
+ if (fir::isa_volatile_ref_type(type)) {
+ effects.emplace_back(mlir::MemoryEffects::Read::get());
+ effects.emplace_back(mlir::MemoryEffects::Write::get());
----------------
vzakhari wrote:
It may be okay to follow the precedent in LLVM dialect, but I think there is a room for improvement. Per LLVM LangRef, `volatile` does allow reordering non-volatile operations with regards to volatile operations, so I wonder if volatile operations should be reading/writing from/to a dedicated `volatile` (or `inaccessible`) resource.
No need to address it in this PR.
https://github.com/llvm/llvm-project/pull/132486
More information about the flang-commits
mailing list