[llvm] fc72f3a - [BTFDebug] Avoid pointer element type access

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 27 01:30:46 PST 2022


Author: Nikita Popov
Date: 2022-01-27T10:30:21+01:00
New Revision: fc72f3a168b6575aae66b8a6519341469267f319

URL: https://github.com/llvm/llvm-project/commit/fc72f3a168b6575aae66b8a6519341469267f319
DIFF: https://github.com/llvm/llvm-project/commit/fc72f3a168b6575aae66b8a6519341469267f319.diff

LOG: [BTFDebug] Avoid pointer element type access

Use the global value type instead.

Added: 
    

Modified: 
    llvm/lib/Target/BPF/BTFDebug.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp
index 608be5160da7e..d536aed1d2114 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -1366,8 +1366,7 @@ void BTFDebug::processGlobals(bool ProcessingMapDef) {
 
     // Calculate symbol size
     const DataLayout &DL = Global.getParent()->getDataLayout();
-    uint32_t Size =
-        DL.getTypeAllocSize(Global.getType()->getPointerElementType());
+    uint32_t Size = DL.getTypeAllocSize(Global.getValueType());
 
     DataSecEntries[std::string(SecName)]->addDataSecEntry(VarId,
         Asm->getSymbol(&Global), Size);


        


More information about the llvm-commits mailing list