diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-07-16 20:26:40 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-07-17 11:09:18 +0200 |
commit | be5af50e7d028849bf2fab5f4b0f2ad36ae56e11 (patch) | |
tree | d37dc35ffd633656cd4c8beccf4d3f41769c7e7f /llvm/lib/IR/Attributes.cpp | |
parent | 173332d175614561770469d237f8c5ba6378a0e7 (diff) | |
download | llvm-be5af50e7d028849bf2fab5f4b0f2ad36ae56e11.zip llvm-be5af50e7d028849bf2fab5f4b0f2ad36ae56e11.tar.gz llvm-be5af50e7d028849bf2fab5f4b0f2ad36ae56e11.tar.bz2 |
[BPF] Use elementtype attribute for preserve.array/struct.index intrinsics
Use the elementtype attribute introduced in 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.
https://reviews.llvm.org/D106184
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 4ef61c7..fc05f52 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -1467,6 +1467,10 @@ Type *AttributeList::getParamInAllocaType(unsigned Index) const { return getAttributes(Index + FirstArgIndex).getInAllocaType(); } +Type *AttributeList::getParamElementType(unsigned Index) const { + return getAttributes(Index + FirstArgIndex).getElementType(); +} + MaybeAlign AttributeList::getStackAlignment(unsigned Index) const { return getAttributes(Index).getStackAlignment(); } |