================
@@ -298,6 +298,12 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const 
DWARFDIE &die) {
       byte_size = form_value.Unsigned();
       break;
 
+    case DW_AT_bit_size:
+      // Convert the bit size to byte size, and round it up to the minimum 
about
+      // of bytes that will fit the bits.
+      byte_size = (form_value.Unsigned() + 7) / 8;
----------------
Michael137 wrote:

Completely out of scope of the PR but wonder if we should introduce something 
in `llvm/Support/MathExtras.h` that does this for us.

```                                                                             
                                                                               
clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone.cpp:969:    
int n = (count + 7) / 8;                                                        
                                                         
clang/test/SemaCXX/constexpr-duffs-device.cpp:6:        unsigned long n = 
(count + 7) / 8;                                                                
                                                            
clang/lib/CodeGen/Targets/X86.cpp:2988:  uint64_t SizeInBytes = 
(CGF.getContext().getTypeSize(Ty) + 7) / 8;                                     
                                                                      
flang/runtime/edit-input.cpp:84:  auto 
significantBytes{static_cast<std::size_t>(digits * LOG2_BASE + 7) / 8};         
                                                                                
               
lldb/source/Core/ValueObjectChild.cpp:172:                    (bitfield_end - 
*type_bit_size + 7) / 8;                                                        
                                                        
lldb/source/Core/DumpDataExtractor.cpp:674:          
(llvm::APFloat::getSizeInBits(semantics) + 7) / 8;                              
                                                                                
 
lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp:1044:    
lldb::offset_t value_alignment = (*opt_alignment + 7ull) / 8ull;                
                  
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h:816:      return 
(*bit_size + 7) / 8;                                                            
                                                              
lldb/source/Symbol/CompilerType.cpp:561:    return (*bit_size + 7) / 8;         
                                                                                
                                                      
lldb/source/Expression/Materializer.cpp:554:        size_t byte_align = 
(*opt_bit_align + 7) / 8;                                                       
                                                              
lldb/source/Expression/Materializer.cpp:952:      size_t byte_align = 
(*opt_bit_align + 7) / 8;                                                       
                                                                
lldb/source/Utility/Scalar.cpp:118:    StoreIntToMemory(val, storage.data(), 
(val.getBitWidth() + 7) / 8);                                                   
                                                         
llvm/include/llvm/CodeGen/MachineValueType.h:354:      return 
{(BaseSize.getKnownMinValue() + 7) / 8, BaseSize.isScalable()};                 
                
llvm/include/llvm/CodeGen/TargetLowering.h:3466:  uint32_t 
CondCodeActions[ISD::SETCC_INVALID][(MVT::VALUETYPE_SIZE + 7) / 8];             
                                                                        
llvm/include/llvm/CodeGen/ValueTypes.h:375:      return 
{(BaseSize.getKnownMinValue() + 7) / 8, BaseSize.isScalable()};                 
                                                                              
llvm/include/llvm/CodeGen/LowLevelType.h:187:    return 
{(BaseSize.getKnownMinValue() + 7) / 8, BaseSize.isScalable()};                 
                                                                              
llvm/utils/TableGen/AsmWriterEmitter.cpp:407:  unsigned BytesNeeded = 
((OpcodeInfoBits - BitsLeft) + 7) / 8;                                          
                                                                
llvm/lib/Analysis/ConstantFolding.cpp:598:  unsigned BytesLoaded = 
(IntType->getBitWidth() + 7) / 8;                                               
                                                                   
llvm/lib/Target/M68k/M68kISelLowering.cpp:736:      uint32_t OpSize = 
(VA.getLocVT().getSizeInBits() + 7) / 8;                                        
                                
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp:1834:    size_t NumBytes = 
(Val.getBitWidth() + 7) / 8;                                                    
                                                                 
llvm/lib/Target/Lanai/MCTargetDesc/LanaiAsmBackend.cpp:101:  unsigned NumBytes 
= (getFixupKindInfo(Kind).TargetSize + 7) / 8;                                  
                                                       
llvm/lib/Target/PowerPC/PPCISelLowering.cpp:5129:  uint32_t OpSize = 
(Arg.getValueSizeInBits() + 7) / 8;                                             
                                                                 
llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp:258:  unsigned NumBytes = 
(getFixupKindInfo(Kind).TargetSize + 7) / 8;                                    
                                                       
llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp:1360:  const unsigned MemSize 
= (Ty.getSizeInBits() + 7) / 8;                                                 
                                                      
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:6441:  const unsigned MemSize = 
(Size + 7) / 8;                                                                 
                                                       
llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp:183:  unsigned 
Size = (BitSize + 7) / 8;                                                       
                                                          
llvm/lib/Target/AArch64/AArch64FastISel.cpp:3087:      unsigned ArgSize = 
(ArgVT.getSizeInBits() + 7) / 8;                                                
                                                            
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:6537:      unsigned NumRegs = 
(Size + 7) / 8;                                                                 
                                                        
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:7700:      OpSize = (OpSize + 
7) / 8;                                                                         
                                                        
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:7451:  unsigned SizeInBytes = 
(Ty.getScalarSizeInBits() + 7) / 8;                                             
                          
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:19493:        PtrOff = (BitWidth 
+ 7 - NewBW) / 8 - PtrOff;
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:28001:  Intervals.insert(0, 
(St->getMemoryVT().getSizeInBits() + 7) / 8,
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:28021:    int64_t Length = 
(Chain->getMemoryVT().getSizeInBits() + 7) / 8;
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:284:    OffsetByte = 
-((AllocBefore + 7) / 8 + (BitWidth + 7) / 8);
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:291:      
Target.setBeforeBytes(AllocBefore, (BitWidth + 7) / 8);
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:301:    OffsetByte = (AllocAfter 
+ 7) / 8;
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:308:      
Target.setAfterBytes(AllocAfter, (BitWidth + 7) / 8);
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1859:          (AllocBefore + 7) 
/ 8 - Target.allocatedBeforeBytes() - 1, 0);
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1861:          (AllocAfter + 7) 
/ 8 - Target.allocatedAfterBytes() - 1, 0);
llvm/lib/Transforms/Utils/VNCoercion.cpp:308:      
(DL.getTypeSizeInBits(SrcVal->getType()).getFixedValue() + 7) / 8;
llvm/lib/Transforms/Utils/VNCoercion.cpp:309:  uint64_t LoadSize = 
(DL.getTypeSizeInBits(LoadTy).getFixedValue() + 7) / 8;
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:1112:  return 
Log2_32_Ceil((TypeSizeFixed + 7) / 8);
mlir/lib/IR/Operation.cpp:160:      
propertiesStorageSize((fullPropertiesStorageSize + 7) / 8), name(name) {
```

https://github.com/llvm/llvm-project/pull/69741
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to