tianshilei1992 added a comment. Another thing is how we deal with a corner case. Say the OpenMP code is written in the following way:
#pragma omp atomic compare x = e < x ? e : x; That's how OpenMP spec defines the atomic operation. `x` is always in "else statement" of a conditional statement. Now we need to lower it to LLVM IR, which is `atomicrmw` operation. Based on the LLVM IR reference, it only supports the atomic operations that `x` is in the "then statement". For example: `x = x > e ? x : e`. See the `x` here is before `:`. In order to lower the OpenMP statement, we have to do a transformation. In order to swap `e` and `x`, we need to transform it to `x = e >= x : x : e`, a.k.a. `x = x <= e : x : e`. However, we don't have an atomic operation for `<=`. We only have `<`. So if `x != e`, the result is good. The incorrectness happens if `x == e`. Recall at the OpenMP statement, when `x == e`, the result should be `x = x`. But if we look at our lowered LLVM IR, `x = x < e : x : e`, when `x == e`, it becomes `x = e`, which doesn't conform with OpenMP spec. What should we do here? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D102449/new/ https://reviews.llvm.org/D102449 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits