[PATCH] D117262: [NFC] Store Address's alignment into PointerIntPairs
Nikita Popov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 26 05:12:20 PST 2022
nikic added a comment.
Approach looks reasonable to me.
================
Comment at: clang/lib/CodeGen/Address.h:29
+// so we fallback to storing the alignment separately.
+template <typename T, bool = alignof(llvm::Value *) >= 8> class AddressImpl {};
+
----------------
Why do we need the extra T parameter?
================
Comment at: clang/lib/CodeGen/Address.h:70
+ unsigned AlignLog = (Pointer.getInt() << 3) | ElementType.getInt();
+ return CharUnits::fromQuantity(1 << AlignLog);
+ }
----------------
This should probably be `1UL` to avoid UB for large alignments.
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