llvm-project/llvm/lib/Target/BPF
Yonghong Song 89648eb16d [BPF] fix a bug for BTF pointee type pruning
In BTF, pointee type pruning is used to reduce cluttering
too many unused types into prog BTF. For example,
   struct task_struct {
      ...
      struct mm_struct *mm;
      ...
   }
If bpf program does not access members of "struct mm_struct",
there is no need to bring types for "struct mm_struct" to BTF.

This patch fixed a bug where an incorrect pruning happened.
The test case like below:
    struct t;
    typedef struct t _t;
    struct s1 { _t *c; };
    int test1(struct s1 *arg) { ... }

    struct t { int a; int b; };
    struct s2 { _t c; }
    int test2(struct s2 *arg) { ... }

After processing test1(), among others, BPF backend generates BTF types for
    "struct s1", "_t" and a placeholder for "struct t".
Note that "struct t" is not really generated. If later a direct access
to "struct t" member happened, "struct t" BTF type will be generated
properly.

During processing test2(), when processing member type "_t c",
BPF backend sees type "_t" already generated, so returned.
This caused the problem that "struct t" BTF type is never generated and
eventually causing incorrect type definition for "struct s2".

To fix the issue, during DebugInfo type traversal, even if a
typedef/const/volatile/restrict derived type has been recorded in BTF,
if it is not a type pruning candidate, type traversal of its base type continues.

Differential Revision: https://reviews.llvm.org/D82041
2020-06-17 15:13:46 -07:00
..
AsmParser [AsmPrinter][MCStreamer] De-capitalize EmitInstruction and EmitCFI* 2020-02-13 22:08:55 -08:00
Disassembler [BPF] fix an asan issue when disassemble an illegal instruction 2020-05-18 22:33:34 -07:00
MCTargetDesc BPFMCTargetDesc.h - remove unused raw_ostream forward declaration. NFC. 2020-04-22 18:26:50 +01:00
TargetInfo CMake: Make most target symbols hidden by default 2020-01-14 19:46:52 -08:00
BPF.h [BPF] preserve debuginfo types for builtin __builtin__btf_type_id() 2020-05-15 08:00:44 -07:00
BPF.td
BPFAbstractMemberAccess.cpp Remove global std::strings. NFCI. 2020-06-17 14:29:42 +02:00
BPFAsmPrinter.cpp [AsmPrinter][MCStreamer] De-capitalize EmitInstruction and EmitCFI* 2020-02-13 22:08:55 -08:00
BPFCORE.h Remove global std::strings. NFCI. 2020-06-17 14:29:42 +02:00
BPFCallingConv.td
BPFFrameLowering.cpp
BPFFrameLowering.h [Alignment][NFC] Use Align for TargetFrameLowering/Subtarget 2019-10-17 07:49:39 +00:00
BPFISelDAGToDAG.cpp [BPF] fix incorrect type in BPFISelDAGToDAG readonly load optimization 2020-06-11 19:31:06 -07:00
BPFISelLowering.cpp [BPF] simplify zero extension with MOV_32_64 2020-05-27 11:26:39 -07:00
BPFISelLowering.h [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering 2020-02-11 09:59:19 -08:00
BPFInstrFormats.td
BPFInstrInfo.cpp [NFC] unsigned->Register in storeRegTo/loadRegFromStack 2020-02-03 14:22:16 +01:00
BPFInstrInfo.h [NFC] unsigned->Register in storeRegTo/loadRegFromStack 2020-02-03 14:22:16 +01:00
BPFInstrInfo.td [BPF] simplify zero extension with MOV_32_64 2020-05-27 11:26:39 -07:00
BPFMCInstLower.cpp
BPFMCInstLower.h [BPF] Remove unused forward declarations. NFC. 2020-04-22 15:07:18 +01:00
BPFMIChecking.cpp Prune a LegacyDivergenceAnalysis and MachineLoopInfo include each 2019-10-19 01:31:09 +00:00
BPFMIPeephole.cpp [BPF] Remove unnecessary MOV_32_64 instructions 2020-06-03 08:14:54 -07:00
BPFMISimplifyPatchable.cpp [BPF] preserve debuginfo types for builtin __builtin__btf_type_id() 2020-05-15 08:00:44 -07:00
BPFPreserveDIType.cpp Remove global std::strings. NFCI. 2020-06-17 14:29:42 +02:00
BPFRegisterInfo.cpp
BPFRegisterInfo.h
BPFRegisterInfo.td
BPFSelectionDAGInfo.cpp
BPFSelectionDAGInfo.h
BPFSubtarget.cpp [BPF] turn on -mattr=+alu32 for cpu version v3 and later 2019-11-07 22:08:46 -08:00
BPFSubtarget.h
BPFTargetMachine.cpp [BPF] preserve debuginfo types for builtin __builtin__btf_type_id() 2020-05-15 08:00:44 -07:00
BPFTargetMachine.h
BTF.def
BTF.h [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs 2020-01-10 09:06:31 -08:00
BTFDebug.cpp [BPF] fix a bug for BTF pointee type pruning 2020-06-17 15:13:46 -07:00
BTFDebug.h [BPF] preserve debuginfo types for builtin __builtin__btf_type_id() 2020-05-15 08:00:44 -07:00
CMakeLists.txt [BPF] preserve debuginfo types for builtin __builtin__btf_type_id() 2020-05-15 08:00:44 -07:00
LLVMBuild.txt