aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2022-02-24 15:51:00 -0800
committerArthur Eubanks <aeubanks@google.com>2022-03-14 10:09:59 -0700
commit250620f76e070cbbd4e8511f751f577b6e1633ac (patch)
tree6e05cbae8f3136e296445075dd89a383b536f09a /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent5d25267d80443b988065507d40ac3a1e902c778b (diff)
downloadllvm-250620f76e070cbbd4e8511f751f577b6e1633ac.zip
llvm-250620f76e070cbbd4e8511f751f577b6e1633ac.tar.gz
llvm-250620f76e070cbbd4e8511f751f577b6e1633ac.tar.bz2
[OpaquePtr][AArch64] Use elementtype on ldxr/stxr
Includes verifier changes checking the elementtype, clang codegen changes to emit the elementtype, and ISel changes using the elementtype. Reviewed By: #opaque-pointers, nikic Differential Revision: https://reviews.llvm.org/D120527
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 5a667f5..3ad5fd7 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -51,6 +51,7 @@
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/IntrinsicsAArch64.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
@@ -4140,14 +4141,23 @@ Error BitcodeReader::propagateAttributeTypes(CallBase *CB,
switch (CB->getIntrinsicID()) {
case Intrinsic::preserve_array_access_index:
case Intrinsic::preserve_struct_access_index:
- if (!Attrs.getParamElementType(0)) {
- Type *ElTy = getPtrElementTypeByID(ArgTyIDs[0]);
+ case Intrinsic::aarch64_ldaxr:
+ case Intrinsic::aarch64_ldxr:
+ case Intrinsic::aarch64_stlxr:
+ case Intrinsic::aarch64_stxr: {
+ unsigned ArgNo = CB->getIntrinsicID() == Intrinsic::aarch64_stlxr ||
+ CB->getIntrinsicID() == Intrinsic::aarch64_stxr
+ ? 1
+ : 0;
+ if (!Attrs.getParamElementType(ArgNo)) {
+ Type *ElTy = getPtrElementTypeByID(ArgTyIDs[ArgNo]);
if (!ElTy)
return error("Missing element type for elementtype upgrade");
Attribute NewAttr = Attribute::get(Context, Attribute::ElementType, ElTy);
- Attrs = Attrs.addParamAttribute(Context, 0, NewAttr);
+ Attrs = Attrs.addParamAttribute(Context, ArgNo, NewAttr);
}
break;
+ }
default:
break;
}