[llvm] r240893 - Revert "Debug Info: One more bitfield bugfix. While yesterday's r240853 fixed"

Adrian Prantl aprantl at apple.com
Sat Jun 27 14:55:01 PDT 2015


Author: adrian
Date: Sat Jun 27 16:55:00 2015
New Revision: 240893

URL: http://llvm.org/viewvc/llvm-project?rev=240893&view=rev
Log:
Revert "Debug Info: One more bitfield bugfix. While yesterday's r240853 fixed"

This reverts commit 240890. Breaking the gdb buildbot.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    llvm/trunk/test/DebugInfo/ARM/bitfield.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=240893&r1=240892&r2=240893&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Sat Jun 27 16:55:00 2015
@@ -1361,29 +1361,24 @@ void DwarfUnit::constructMemberDIE(DIE &
       // | ...             |b1|b2|b3|b4|
       // +-----------+-----*-----+-----*-----+--
       // |           |     |<-- Size ->|     |
-      // |<---- Offset --->|     |     |<--->|
-      // |           |     |     |        \_ DW_AT_bit_offset (little endian)
-      // |           |<--->|     |
-      // |<--big-e.->|  \_ StartBitOffset = DW_AT_bit_offset (big endian)
-      // |      ^                |        = DW_AT_data_bit_offset (biendian)
-      // | OffsetInBytes         |
-      // |      v                |
-      // |<----little-endian---->|
+      // |<---- Offset --->|           |<--->|
+      // |           |     |              \_ DW_AT_bit_offset (little endian)
+      // |           |<--->|
+      // |<--------->|  \_ StartBitOffset = DW_AT_bit_offset (big endian)
+      //     \                            = DW_AT_data_bit_offset (biendian)
+      //      \_ OffsetInBytes
       uint64_t Offset = DT->getOffsetInBits();
       uint64_t Align = DT->getAlignInBits() ? DT->getAlignInBits() : FieldSize;
       uint64_t AlignMask = ~(Align - 1);
       // The bits from the start of the storage unit to the start of the field.
       uint64_t StartBitOffset = Offset - (Offset & AlignMask);
-      // OffsetInBytes is the byte offset of the field's aligned storage unit
-      // inside the struct.
-      uint64_t DwarfBitOffset;
-      if (Asm->getDataLayout().isLittleEndian()) {
-        DwarfBitOffset = OffsetToAlignment(Offset + Size, Align);
-        OffsetInBytes = ((Offset + Size) & AlignMask) / 8;
-      } else {
-        DwarfBitOffset = StartBitOffset;
-        OffsetInBytes = (Offset - StartBitOffset) / 8;
-      }
+      // The endian-dependent DWARF 2 offset.
+      uint64_t DwarfBitOffset = Asm->getDataLayout().isLittleEndian()
+        ? OffsetToAlignment(Offset + Size, Align)
+        : StartBitOffset;
+
+      // The byte offset of the field's aligned storage unit inside the struct.
+      OffsetInBytes = (Offset - StartBitOffset) / 8;
       addUInt(MemberDie, dwarf::DW_AT_bit_offset, None, DwarfBitOffset);
     } else
       // This is not a bitfield.

Modified: llvm/trunk/test/DebugInfo/ARM/bitfield.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/ARM/bitfield.ll?rev=240893&r1=240892&r2=240893&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/ARM/bitfield.ll (original)
+++ llvm/trunk/test/DebugInfo/ARM/bitfield.ll Sat Jun 27 16:55:00 2015
@@ -14,7 +14,7 @@
 ; CHECK:          DW_AT_byte_size  {{.*}} (0x04)
 ; CHECK:          DW_AT_bit_size   {{.*}} (0x1c)
 ; CHECK:          DW_AT_bit_offset {{.*}} (0x18)
-; CHECK:          DW_AT_data_member_location {{.*}}04
+; CHECK:          DW_AT_data_member_location {{.*}}00
 target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
 target triple = "thumbv7-apple-ios"
 





More information about the llvm-commits mailing list