[clang] Fix tbaa.struct metadata for bitfields using big endian. (PR #87753)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 5 03:32:08 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
----------------
dobbelaj-snps wrote:

I see. Then it might make sense to keep what you did, but add a comment referring to that function ? It does has a lot more comments on what is going on there. 


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


More information about the cfe-commits mailing list