[flang-commits] [flang] [mlir] [flang][OpenMP] Support for "atomic compare capture" (PR #202315)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Thu Jun 18 09:41:44 PDT 2026
================
@@ -617,6 +646,17 @@ void Fortran::lower::omp::lowerAtomic(
expectedVal = builder.createConvert(loc, elemTypeOfX, expectedVal);
}
+ // If this is a compare+capture, generate the read op first.
+ if (construct.IsCapture()) {
+ assert(get(analysis.op0.assign) && (analysis.op0.what & analysis.Read) &&
+ "Expected a read operation for compare capture");
----------------
tblah wrote:
This assert is reachable e.g.
```
subroutine s_prefix(x, e, d, v)
integer :: x, e, d, v
!$omp atomic compare capture
if (x .eq. e) x = d
v = x
!$omp end atomic
end subroutine
```
https://github.com/llvm/llvm-project/pull/202315
More information about the flang-commits
mailing list