[clang] [CIR] Return power-of-two ABI alignment for non-fundamental int widths (PR #210187)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 17 07:04:09 PDT 2026


================
@@ -809,7 +809,13 @@ uint64_t IntType::getABIAlignment(const mlir::DataLayout &dataLayout,
         std::min(llvm::PowerOf2Ceil(width), static_cast<uint64_t>(64));
     return std::max(alignBits / 8, static_cast<uint64_t>(1));
   }
-  return (uint64_t)(width / 8);
+  // Round up to a power-of-two byte alignment.  DataLayout consumers such as
+  // llvm::Align require power-of-two alignments, and width / 8 is not a power
+  // of two for non-fundamental widths (e.g. i24 -> 3).  This leaves the
----------------
adams381 wrote:

We cannot.  This is really just a defensive fallback.

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


More information about the cfe-commits mailing list