[clang] Fix tbaa.struct metadata for bitfields using big endian. (PR #87753)
Julian Nagele via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 5 02:50:57 PDT 2024
================
@@ -319,7 +320,10 @@ CodeGenTBAA::CollectFields(uint64_t BaseOffset,
// base type.
if ((*i)->isBitField()) {
const CGBitFieldInfo &Info = CGRL.getBitFieldInfo(*i);
- if (Info.Offset != 0)
+ bool IsBE = Context.getTargetInfo().isBigEndian();
+ bool IsFirst = IsBE ? Info.StorageSize - (Info.Offset + Info.Size) == 0
----------------
juliannagele wrote:
Agreed, and that's what I had originally, but then saw https://github.com/llvm/llvm-project/blob/0b7362c257ff7b656c31266b4f9b8485a7ba4033/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp#L759 so thought I'd go with the same structure, but no strong feelings either way.
https://github.com/llvm/llvm-project/pull/87753
More information about the cfe-commits
mailing list