[Mlir-commits] [clang] [flang] [mlir] [flang][flang-driver][mlir][OpenMP] atomic control support (PR #143441)
Sergio Afonso
llvmlistbot at llvm.org
Thu Jul 24 07:21:28 PDT 2025
================
@@ -88,6 +88,53 @@ void fir::setTuneCPU(mlir::ModuleOp mod, llvm::StringRef cpu) {
mod->setAttr(tuneCpuName, mlir::StringAttr::get(ctx, cpu));
}
+static constexpr const char *atomicIgnoreDenormalModeName =
+ "fir.atomic_ignore_denormal_mode";
+void fir::setAtomicIgnoreDenormalMode(mlir::ModuleOp mod, bool value) {
+ if (value) {
+ auto *ctx = mod.getContext();
+ mod->setAttr(atomicIgnoreDenormalModeName, mlir::UnitAttr::get(ctx));
+ } else {
+ if (mod->hasAttr(atomicIgnoreDenormalModeName))
+ mod->removeAttr(atomicIgnoreDenormalModeName);
+ }
+}
+
+bool fir::getAtomicIgnoreDenormalMode(mlir::ModuleOp mod) {
+ return mod->hasAttrOfType<mlir::UnitAttr>(atomicIgnoreDenormalModeName);
----------------
skatrak wrote:
Nit: I'd skip checking the attribute type for simplicity, but feel free to leave this unchanged if you disagree.
```suggestion
return mod->hasAttr(atomicIgnoreDenormalModeName);
```
https://github.com/llvm/llvm-project/pull/143441
More information about the Mlir-commits
mailing list