]> granicus.if.org Git - llvm/commit
[BPF] handle derived type properly for computing type id
authorYonghong Song <yhs@fb.com>
Fri, 22 Mar 2019 01:30:50 +0000 (01:30 +0000)
committerYonghong Song <yhs@fb.com>
Fri, 22 Mar 2019 01:30:50 +0000 (01:30 +0000)
commit527ff218843f03b3bbec4ce53a89bebb1e66fdbf
treee400880714211877e7b7fcb3bc1ddee273128af8
parentcfac065bea6cad42bc48df8c823f304ed0bbb387
[BPF] handle derived type properly for computing type id

Currently, the type id for a derived type is computed incorrectly.
For example,
  type #1: int
  type #2: ptr to #1

For a global variable "int *a", type #1 will be attributed to variable "a".
This is due to a bug which assigns the type id of the basetype of
that derived type as the derived type's type id. This happens
to "const", "volatile", "restrict", "typedef" and "pointer" types.

This patch fixed this bug, fixed existing test cases and added
a new one focusing on pointers plus other derived types.

Signed-off-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356727 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/BPF/BTFDebug.cpp
test/CodeGen/BPF/BTF/global-var-sec-readonly.ll
test/CodeGen/BPF/BTF/static-var-derived-type.ll [new file with mode: 0644]
test/CodeGen/BPF/BTF/static-var-inited-sec.ll
test/CodeGen/BPF/BTF/static-var-inited.ll
test/CodeGen/BPF/BTF/static-var-readonly-sec.ll
test/CodeGen/BPF/BTF/static-var-readonly.ll
test/CodeGen/BPF/BTF/static-var-sec.ll
test/CodeGen/BPF/BTF/static-var-zerolen-array.ll
test/CodeGen/BPF/BTF/static-var.ll