[llvm] [DataLayout] Add byte specification (PR #106536)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 11:21:39 PDT 2024


================
@@ -91,6 +91,9 @@ class DataLayout {
 private:
   bool BigEndian = false;
 
+  /// The size of a byte in bits.
+  unsigned ByteWidth = 8;
----------------
arichardson wrote:

I think we should store this as a shift value instead of a width since it will allow Clang/GCC to elide divisions (see https://godbolt.org/z/5T86s84Ez case 3 optimizes to a right shift).
And it looks like this also works for divideCeil: https://godbolt.org/z/1oa18Gns7

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


More information about the llvm-commits mailing list