[Mlir-commits] [flang] [mlir] Fixing miscompilation with OMP synchronization at higher optimizations (PR #202258)

Deepak Eachempati llvmlistbot at llvm.org
Fri Oct 30 15:46:12 PDT 2026


================

----------------
dreachem wrote:

This instruction looks like it would clobber all memory, not just the locations in `ptrs`. 

Ideally, the solution would be to emit an intrinsic call that inhibits the unsafe optimization but doesn't result in any generated code. It could be defined like:

```
declare void @llvm.omp.sync.marker(ptr)
    memory(argmem: readwrite)
```

Then we'd emit calls to this intrinsic, rather than the memory-clobber instruction, at locations that imply a barrier or otherwise imply release/acquire synchronization. We'd need to test that it actually works to inhibit the unsafe optimization. 


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


More information about the Mlir-commits mailing list