[PATCH] D106184: [BPF] Use elementtype attribute for preserve.array/struct.index intrinsics

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 16 13:18:40 PDT 2021


nikic created this revision.
nikic added reviewers: opaque-pointers, yonghong-song.
Herald added subscribers: dexonsmith, jdoerfert, arphaman, hiraditya.
nikic requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Use the elementtype attribute introduced in D105407 <https://reviews.llvm.org/D105407> for the llvm.preserve.array/struct.index intrinsics. It carries the element type of the GEP these intrinsics effectively encode.

This patch:

- Adds a verifier check that the attribute is required.
- Adds it in the IRBuilder methods for these intrinsics.
- Autoupgrades old bitcode without the attribute.
- Updates the lowering code to use the attribute rather than the pointer element type.
- Updates lots of tests to specify the attribute.
- Adds `-force-opaque-pointers` to the intrinsic-array.ll test to demonstrate they work now.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106184

Files:
  clang/test/CodeGen/bpf-attr-preserve-access-index-1.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-2.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-3.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-4.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-5.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-6.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-7.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-8.c
  clang/test/CodeGen/builtin-preserve-access-index-array.c
  clang/test/CodeGen/builtin-preserve-access-index-nonptr.c
  clang/test/CodeGen/builtin-preserve-access-index-typedef.c
  clang/test/CodeGen/builtin-preserve-access-index.c
  clang/test/CodeGen/builtins-bpf-preserve-field-info-1.c
  clang/test/CodeGen/builtins-bpf-preserve-field-info-2.c
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/Attributes.h
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/IRBuilder.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
  llvm/test/Bitcode/upgrade-elementtype.ll
  llvm/test/Bitcode/upgrade-elementtype.ll.bc
  llvm/test/CodeGen/BPF/CORE/field-reloc-alu32.ll
  llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1-bpfeb.ll
  llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1.ll
  llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-2-bpfeb.ll
  llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-2.ll
  llvm/test/CodeGen/BPF/CORE/field-reloc-duplicate.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-array-2.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-array.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-byte-size-1.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-byte-size-2.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-byte-size-3.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-byte-size-4.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-existence-1.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-existence-2.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-existence-3.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-existence-4.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-lshift-1-bpfeb.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-lshift-1.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-lshift-2.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-rshift-1.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-rshift-2.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-rshift-3.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-signedness-1.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-signedness-2.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-signedness-3.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-struct.ll
  llvm/test/CodeGen/BPF/CORE/no-elf-ama-symbol.ll
  llvm/test/CodeGen/BPF/CORE/no-narrow-load.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-access-str.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-basic.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-cast-array-1.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-cast-array-2.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-cast-struct-1.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-cast-struct-2.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-cast-struct-3.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-cast-union-2.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-end-load.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-end-ret.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-fieldinfo-1.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-fieldinfo-2-bpfeb.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-fieldinfo-2.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-global-1.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-global-2.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-global-3.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-ignore.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-middle-chain.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-multi-array-1.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-multi-array-2.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-multilevel.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-pointer-1.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-pointer-2.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-anonymous.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-array.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-typedef-array.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-typedef-struct-2.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-typedef-struct.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-typedef.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-union.ll
  llvm/test/CodeGen/BPF/CORE/store-addr.ll
  llvm/test/Verifier/elementtype.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106184.359425.patch
Type: text/x-patch
Size: 129449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210716/4e6d6373/attachment-0001.bin>


More information about the llvm-commits mailing list