[all-commits] [llvm/llvm-project] c69ed6: [BPF] fix a bug for BTF pointee type pruning

kadir çetinkaya via All-commits all-commits at lists.llvm.org
Tue Jun 23 14:24:40 PDT 2020


  Branch: refs/heads/release/10.x
  Home:   https://github.com/llvm/llvm-project
  Commit: c69ed62ea195a598c62e216fa45bbe1b1ede5bae
      https://github.com/llvm/llvm-project/commit/c69ed62ea195a598c62e216fa45bbe1b1ede5bae
  Author: Yonghong Song <yhs at fb.com>
  Date:   2020-06-23 (Tue, 23 Jun 2020)

  Changed paths:
    M llvm/lib/Target/BPF/BTFDebug.cpp
    A llvm/test/CodeGen/BPF/BTF/pruning-const.ll
    A llvm/test/CodeGen/BPF/BTF/pruning-typedef.ll

  Log Message:
  -----------
  [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

(cherry picked from commit 89648eb16d01725457f958e634d16c534b64c42c)


  Commit: 97065683c6a965be9bc3dc06b0264940ed75c4af
      https://github.com/llvm/llvm-project/commit/97065683c6a965be9bc3dc06b0264940ed75c4af
  Author: Kadir Cetinkaya <kadircet at google.com>
  Date:   2020-06-23 (Tue, 23 Jun 2020)

  Changed paths:
    M clang-tools-extra/clangd/FindSymbols.cpp
    M clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp

  Log Message:
  -----------
  [clangd] Fix DocumentOutline for concepts

Summary: Fixes https://github.com/clangd/clangd/issues/256

Reviewers: kbobyrev

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73056

(cherry picked from commit fb3d9153c01b9a560680465190d6ecd804e4c486)


Compare: https://github.com/llvm/llvm-project/compare/177a9ac3c6bc...97065683c6a9


More information about the All-commits mailing list