[PATCH] D117262: [NFC] Store Address's alignment into PointerIntPairs

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 18 13:50:53 PST 2022


nikic added inline comments.


================
Comment at: clang/lib/CodeGen/Address.h:45
+    auto AlignLog = llvm::Log2_64(alignment.getQuantity());
+    assert(AlignLog < (1 << 6) && "cannot fit alignment into 6 bits");
+    Pointer.setInt(AlignLog >> 3);
----------------
nikic wrote:
> Why can we assume this?
Ah, the alignment is 64-bits, so the log2 is 0-63, which fits exactly into 6 bits. That's handy :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117262



More information about the cfe-commits mailing list