[PATCH] D61432: Non-8-bit bytes showcase

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 08:15:13 PDT 2019


probinson added inline comments.


================
Comment at: include/llvm/IR/DataLayout.h:421
   unsigned getPointerTypeSize(Type *Ty) const {
-    return getPointerTypeSizeInBits(Ty) / 8;
+    return getPointerTypeSizeInBits(Ty) / BitsPerByte;
   }
----------------
riccibruno wrote:
> That's an expensive division...
Maybe derive a pointer-type-size-in-bytes calculated in the ctor.
Or, as a more generic solution, derive shift/mask values from bits-per-byte, so the refactoring can replace multiply/divide with shifts.  Or maybe with bitsToBytes and bytesToBits helper methods.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61432/new/

https://reviews.llvm.org/D61432





More information about the llvm-commits mailing list