[flang-commits] [flang] [flang][nfc] Support volatility in Fir ops (PR #134858)
Asher Mancinelli via flang-commits
flang-commits at lists.llvm.org
Tue Apr 22 08:17:58 PDT 2025
================
@@ -15,13 +15,26 @@
namespace fir {
-/// Return true iff the Operation is a non-volatile LoadOp or ArrayLoadOp.
-inline bool nonVolatileLoad(mlir::Operation *op) {
- if (auto load = mlir::dyn_cast<fir::LoadOp>(op))
- return !load->getAttr("volatile");
- if (auto arrLoad = mlir::dyn_cast<fir::ArrayLoadOp>(op))
- return !arrLoad->getAttr("volatile");
- return false;
+/// The LLVM dialect represents volatile memory accesses as read and write
+/// effects to an unknown memory location, but this may be overly conservative.
+/// LLVM Language Reference only specifies that volatile memory accesses
+/// must not be reordered relative to other volatile memory accesses, so it
+/// is more precise to use a separate memory resource for volatile memory
+/// accesses.
+inline void addVolatileMemoryEffects(
----------------
ashermancinelli wrote:
I do - do you have concerns about them that I should look into?
https://github.com/llvm/llvm-project/pull/134858
More information about the flang-commits
mailing list