diff options
| author | Yonghong Song <yhs@fb.com> | 2019-03-15 05:02:19 +0000 |
|---|---|---|
| committer | Yonghong Song <yhs@fb.com> | 2019-03-15 05:02:19 +0000 |
| commit | bf3a279bced16020a70972d4c89fbed16ae5e428 (patch) | |
| tree | b1254d56f2d172761769669a8dc5ee680b0d46d4 /llvm/lib/Target/BPF | |
| parent | 5664d4c8cae925cb04994c6e7e46342aacc64bec (diff) | |
| download | bcm5719-llvm-bf3a279bced16020a70972d4c89fbed16ae5e428.tar.gz bcm5719-llvm-bf3a279bced16020a70972d4c89fbed16ae5e428.zip | |
Revert "[BPF] do not generate unused local/global types"
This reverts commit r356232.
Reason: test failure with ASSERT on enabled build.
llvm-svn: 356233
Diffstat (limited to 'llvm/lib/Target/BPF')
| -rw-r--r-- | llvm/lib/Target/BPF/BTFDebug.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp index 6e4ee039ca0..3f5531357a9 100644 --- a/llvm/lib/Target/BPF/BTFDebug.cpp +++ b/llvm/lib/Target/BPF/BTFDebug.cpp @@ -658,12 +658,12 @@ void BTFDebug::beginFunctionImpl(const MachineFunction *MF) { std::unordered_map<uint32_t, StringRef> FuncArgNames; for (const DINode *DN : SP->getRetainedNodes()) { if (const auto *DV = dyn_cast<DILocalVariable>(DN)) { + visitTypeEntry(DV->getType().resolve()); + // Collect function arguments for subprogram func type. uint32_t Arg = DV->getArg(); - if (Arg) { - visitTypeEntry(DV->getType().resolve()); + if (Arg) FuncArgNames[Arg] = DV->getName(); - } } } @@ -749,15 +749,10 @@ void BTFDebug::beginInstruction(const MachineInstr *MI) { void BTFDebug::endModule() { // Collect all types referenced by globals. const Module *M = MMI->getModule(); - for (const GlobalVariable &Global : M->globals()) { - // Ignore external globals for now. - if (!Global.getInitializer()) - continue; - - SmallVector<DIGlobalVariableExpression *, 1> GVs; - Global.getDebugInfo(GVs); - for (auto *GVE : GVs) { - visitTypeEntry(GVE->getVariable()->getType().resolve()); + for (const DICompileUnit *CUNode : M->debug_compile_units()) { + for (const auto *GVE : CUNode->getGlobalVariables()) { + DIGlobalVariable *GV = GVE->getVariable(); + visitTypeEntry(GV->getType().resolve()); } } |

