[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
This commit is contained in:
Arthur Eubanks
2022-02-24 15:51:00 -08:00
parent 5d25267d80
commit 250620f76e
15 changed files with 175 additions and 104 deletions

View File

@@ -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;
}