[all-commits] [llvm/llvm-project] 9516ed: [CIR][NFC] Extract record-rebuilding type converte...

Konstantinos Parasyris via All-commits all-commits at lists.llvm.org
Sat Oct 3 11:23:04 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9516ed8a09227a92fe07229f92b1b929843d5e17
      https://github.com/llvm/llvm-project/commit/9516ed8a09227a92fe07229f92b1b929843d5e17
  Author: Konstantinos Parasyris <koparasy at gmail.com>
  Date:   2026-10-03 (Sat, 03 Oct 2026)

  Changed paths:
    M clang/lib/CIR/Dialect/Transforms/CMakeLists.txt
    M clang/lib/CIR/Dialect/Transforms/CXXABILowering.cpp
    A clang/lib/CIR/Dialect/Transforms/RecordTypeConverter.cpp
    A clang/lib/CIR/Dialect/Transforms/RecordTypeConverter.h

  Log Message:
  -----------
  [CIR][NFC] Extract record-rebuilding type converter from CXXABILowering (#228599)

CXXABILowering's type converter rebuilds identified records whose member
types change. Because identified records cannot be modified in place,
each one is recreated under a temporary name, recursive records are
resolved with a per-thread conversion stack, and the original names are
restored once the conversion is done.

This patch moves the `CIRABITypeConverter` machinery into a reusable
base class, `cir::RecordRewritingTypeConverter`.
`CIRABITypeConverter` now derives from it and only adds the C++ ABI
specific conversions (data member and method types).

TargetLowering needs the same record rebuilding to convert language
address spaces nested in record members. Today the following OpenCL code
fails on SPIR-V:
```
    struct S { __global int *p; int n; };
    kernel void k(__global int *g) {
      struct S s;
      s.p = g;
      *s.p = 1;
    }
```
> error: member type mismatch

TargetLowering converts the `get_member` result to `!cir.ptr<!s32i,
target_address_space(1)>`, but the field type inside `!rec_S` stays
`lang_address_space(offload_global)`, so the verifier rejects the op.
The same issue affects SYCL device code.

A follow-up will make TargetLowering's type converter derive from this
class and use `shouldConvertRecord` to rebuild only the records that
contain language address spaces. Records without them (e.g. all CUDA/HIP
records) stay untouched, so the operations using them stay legal.



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