llvm-project/llvm/lib/Target/BPF
Yonghong Song 3671bdbcd2 [BPF] Fix a BTF type pruning bug
In BPF backend, BTF type generation may skip
some debuginfo types if they are the pointee
type of a struct member. For example,
  struct task_struct {
    ...
    struct mm_struct                *mm;
    ...
  };
BPF backend may generate a forward decl for
'struct mm_struct' instead of full type if
there are no other usage of 'struct mm_struct'.
The reason is to avoid bringing too much unneeded types
in BTF.

Alexei found a pruning bug where we may miss
some full type generation. The following is an illustrating
example:
   struct t1 { ... }
   struct t2 { struct t1 *p; };
   struct t2 g;
   void foo(struct t1 *arg) { ... }
In the above case, we will have partial debuginfo chain like below:
   struct t2 -> member p
                        \ -> ptr -> struct t1
                        /
     foo -> argument arg
During traversing
   struct t2 -> member p -> ptr -> struct t1
The corresponding BTF types are generated except 'struct t1' which
will be in FixUp stage. Later, when traversing
   foo -> argument arg -> ptr -> struct t1
The 'ptr' BTF type has been generated and currently implementation
ignores 'pointer' type hence 'struct t1' is not generated.

This patch fixed the issue not just for the above case, but for
general case with multiple derived types, e.g.,
   struct t2 -> member p
                        \ -> const -> ptr -> volatile -> struct t1
                        /
     foo -> argument arg

Differential Revision: https://reviews.llvm.org/D119986
2022-02-16 17:23:34 -08:00
..
AsmParser Cleanup MCParser headers 2022-02-11 10:39:29 +01:00
Disassembler Cleanup LLVMMC headers 2022-02-09 11:09:17 +01:00
MCTargetDesc [NFC][MC] remove unused argument `MCRegisterInfo` in `MCCodeEmitter` 2022-02-16 13:10:09 +08:00
TargetInfo Fix shlib builds for all lib/Target/*/TargetInfo libs 2021-10-08 15:21:13 -07:00
BPF.h BPF: remove intrindics @llvm.stacksave() and @llvm.stackrestore() 2021-10-18 09:51:19 -07:00
BPF.td
BPFAbstractMemberAccess.cpp Reduce dependencies on llvm/BinaryFormat/Dwarf.h 2022-02-04 11:44:03 +01:00
BPFAdjustOpt.cpp BPF: Workaround InstCombine trunc+icmp => mask+icmp Optimization 2021-11-18 20:25:28 -08:00
BPFAsmPrinter.cpp Move TargetRegistry.(h|cpp) from Support to MC 2021-10-08 14:51:48 -07:00
BPFCORE.h
BPFCallingConv.td
BPFCheckAndAdjustIR.cpp BPF: Workaround an InstCombine ICmp transformation with llvm.bpf.compare builtin 2021-11-01 14:46:20 -07:00
BPFFrameLowering.cpp
BPFFrameLowering.h
BPFIRPeephole.cpp BPF: fix a bug in IRPeephole pass 2021-10-18 10:18:24 -07:00
BPFISelDAGToDAG.cpp
BPFISelLowering.cpp [llvm] Use nullptr instead of 0 (NFC) 2021-12-28 08:52:25 -08:00
BPFISelLowering.h BPF: implement isLegalAddressingMode() properly 2021-09-30 16:41:15 -07:00
BPFInstrFormats.td
BPFInstrInfo.cpp
BPFInstrInfo.h
BPFInstrInfo.td
BPFMCInstLower.cpp [Target] Use range-based for loops (NFC) 2021-11-26 08:23:01 -08:00
BPFMCInstLower.h
BPFMIChecking.cpp Remove redundant void arguments (NFC) 2022-01-02 10:20:19 -08:00
BPFMIPeephole.cpp Remove redundant void arguments (NFC) 2022-01-02 10:20:19 -08:00
BPFMISimplifyPatchable.cpp Remove redundant void arguments (NFC) 2022-01-02 10:20:19 -08:00
BPFPreserveDIType.cpp Reduce dependencies on llvm/BinaryFormat/Dwarf.h 2022-02-04 11:44:03 +01:00
BPFRegisterInfo.cpp
BPFRegisterInfo.h
BPFRegisterInfo.td BPF: make 32bit register spill with 64bit alignment 2021-09-20 21:00:25 -07:00
BPFSelectionDAGInfo.cpp
BPFSelectionDAGInfo.h
BPFSubtarget.cpp [Target] Remove redundant member initialization (NFC) 2022-01-06 22:01:44 -08:00
BPFSubtarget.h
BPFTargetMachine.cpp BPF: remove intrindics @llvm.stacksave() and @llvm.stackrestore() 2021-10-18 09:51:19 -07:00
BPFTargetMachine.h
BPFTargetTransformInfo.h [Target][CodeGen] Remove default CostKind arguments on inner/impl TTI overrides 2021-09-22 15:28:08 +01:00
BTF.def BPF: Support btf_type_tag attribute 2021-11-04 17:01:36 -07:00
BTF.h BPF: Support btf_type_tag attribute 2021-11-04 17:01:36 -07:00
BTFDebug.cpp [BPF] Fix a BTF type pruning bug 2022-02-16 17:23:34 -08:00
BTFDebug.h [BPF] Fix a bug in BTF_KIND_TYPE_TAG generation 2022-02-14 19:43:57 -08:00
CMakeLists.txt BPF: remove intrindics @llvm.stacksave() and @llvm.stackrestore() 2021-10-18 09:51:19 -07:00