[all-commits] [llvm/llvm-project] 40ae05: [CIR] Return power-of-two ABI alignment for non-fu...

adams381 via All-commits all-commits at lists.llvm.org
Fri Jul 17 07:08:08 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 40ae05d4773f5c1b2a84ea7dc908d92671b8daa9
      https://github.com/llvm/llvm-project/commit/40ae05d4773f5c1b2a84ea7dc908d92671b8daa9
  Author: adams381 <adams at nvidia.com>
  Date:   2026-07-17 (Fri, 17 Jul 2026)

  Changed paths:
    M clang/lib/CIR/Dialect/IR/CIRTypes.cpp
    M clang/unittests/CIR/CMakeLists.txt
    A clang/unittests/CIR/IntTypeABIAlignTest.cpp

  Log Message:
  -----------
  [CIR] Return power-of-two ABI alignment for non-fundamental int widths (#210187)

`cir::IntType::getABIAlignment` returns `width / 8` for non-`_BitInt`
integers. For a non-fundamental width such as `i24` it returns 3, which
is
not a power of two, so a consumer that builds an `llvm::Align` from it
would
hit the power-of-two assertion unless it rounds the value up itself.

This rounds the alignment up to a power of two inside `getABIAlignment`,
matching how LLVM's default DataLayout aligns these (an `i24` aligns
like
`i32`). The fundamental widths are unchanged (`i8` -> 1, `i16` -> 2,
`i32` -> 4, `i64` -> 8), `__int128` stays at 16, and a sub-byte width
like
`i1` now reports 1 instead of 0. A unit test pins these cases.



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