[all-commits] [llvm/llvm-project] 54b842: [OpenMP][OMPIRBuilder] Support complex types in at...

Chi-Chun, Chen via All-commits all-commits at lists.llvm.org
Mon Apr 13 10:19:30 PDT 2026


  Branch: refs/heads/users/cchen/fix_atomic_cmpexcg_mem_order
  Home:   https://github.com/llvm/llvm-project
  Commit: 54b842daa7d1914aa9c200ad4d1bd6a4a67886d8
      https://github.com/llvm/llvm-project/commit/54b842daa7d1914aa9c200ad4d1bd6a4a67886d8
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-04-10 (Fri, 10 Apr 2026)

  Changed paths:
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    M mlir/test/Target/LLVMIR/openmp-llvm.mlir

  Log Message:
  -----------
  [OpenMP][OMPIRBuilder] Support complex types in atomic update/capture

Route struct-typed values through the libcall path in
`emitAtomicUpdate`.

Previously, the libcall path was gated on `RMWOp == BAD_BINOP`, so
atomic capture swap patterns (`v = x; x = expr`) for complex values
lowered as structs fell through to the cmpxchg path. That path called
`getScalarSizeInBits()` on a struct type, produced 0, and triggered an
assertion in `IntegerType::get()`.

Remove the `BAD_BINOP` restriction so struct types always use the
libcall path. This is safe because the libcall path does not use
`RMWOp` and already handles arbitrary type sizes correctly.

Also fix `LoadSize` in the libcall path to use `XElemTy` rather than
the pointer type, which previously gave the wrong size for larger
complex types such as `complex(8)`.

Fixes https://github.com/llvm/llvm-project/issues/191317

Assisted with copilot and GPT-5.4


  Commit: 8ea5bfa919c5d2bb2c5d986a0bf5a0a7580f8715
      https://github.com/llvm/llvm-project/commit/8ea5bfa919c5d2bb2c5d986a0bf5a0a7580f8715
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-04-13 (Mon, 13 Apr 2026)

  Changed paths:
    M llvm/lib/Frontend/Atomic/Atomic.cpp
    M mlir/test/Target/LLVMIR/openmp-llvm.mlir

  Log Message:
  -----------
  [OpenMP][OMPIRBuilder] Fix memory order for atomic compare exchange


Compare: https://github.com/llvm/llvm-project/compare/54b842daa7d1%5E...8ea5bfa919c5

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list