[flang-commits] [flang] [mlir] [Flang][OpenMP][OpenACC][MLIR] Remove typechecks in atomic write/upda… (PR #85059)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Mon Mar 25 02:02:00 PDT 2024


kiranchandramohan wrote:

> However, since we already emit a fir.convert operation, I propose removing these checks. This simplification leverages the existing conversion operation to handle these cases appropriately.

When changing MLIR code we should avoid explanations like this since Flang is not the only user of the OpenMP/OpenACC MLIR dialects.

Ideally, we should generate the following FIR. Can you check whether we are using the typed or evaluated expression for lowering atomic write? Typed expressions have converts automatically inserted.

```
!CHECK: %false = arith.constant false
!CHECK: %converted_false = fir.convert %false : i1 -> !fir.logical<4>
!CHECK: omp.atomic.write %[[L_DECL]]#1 = %false : !fir.ref<!fir.logical<4>>, !fir.logical<4>
```

At the MLIR level, this makes it too permissive. Do we have appropriate errors in the MLIR translation for types that are not compatible?

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


More information about the flang-commits mailing list