aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorOliver Stannard <oliver.stannard@linaro.org>2021-03-29 11:31:17 +0100
committerOliver Stannard <oliver.stannard@linaro.org>2021-03-29 11:32:22 +0100
commit07e46367baeca96d84b03fa215b41775f69d5989 (patch)
tree154a7d4ca86da09b4610d7be3b4b4fb72e612f42 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parentb5da813fe91ee1d7b965bf3aa72e56a13d02dd7d (diff)
downloadllvm-07e46367baeca96d84b03fa215b41775f69d5989.zip
llvm-07e46367baeca96d84b03fa215b41775f69d5989.tar.gz
llvm-07e46367baeca96d84b03fa215b41775f69d5989.tar.bz2
Revert "Reapply "OpaquePtr: Turn inalloca into a type attribute""
Reverting because test 'Bindings/Go/go.test' is failing on most buildbots. This reverts commit fc9df309917e57de704f3ce4372138a8d4a23d7a.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp48
1 files changed, 10 insertions, 38 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 46db3ed..951e32e 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1624,8 +1624,6 @@ Error BitcodeReader::parseAttributeGroupBlock() {
B.addByValAttr(nullptr);
else if (Kind == Attribute::StructRet)
B.addStructRetAttr(nullptr);
- else if (Kind == Attribute::InAlloca)
- B.addInAllocaAttr(nullptr);
B.addAttribute(Kind);
} else if (Record[i] == 1) { // Integer attribute
@@ -1677,8 +1675,6 @@ Error BitcodeReader::parseAttributeGroupBlock() {
B.addByRefAttr(getTypeByID(Record[++i]));
} else if (Kind == Attribute::Preallocated) {
B.addPreallocatedAttr(getTypeByID(Record[++i]));
- } else if (Kind == Attribute::InAlloca) {
- B.addInAllocaAttr(HasType ? getTypeByID(Record[++i]) : nullptr);
}
}
}
@@ -3332,8 +3328,7 @@ Error BitcodeReader::parseFunctionRecord(ArrayRef<uint64_t> Record) {
// argument's pointee type. There should be no opaque pointers where the byval
// type is implicit.
for (unsigned i = 0; i != Func->arg_size(); ++i) {
- for (Attribute::AttrKind Kind : {Attribute::ByVal, Attribute::StructRet,
- Attribute::InAlloca}) {
+ for (Attribute::AttrKind Kind : {Attribute::ByVal, Attribute::StructRet}) {
if (!Func->hasParamAttribute(i, Kind))
continue;
@@ -3341,21 +3336,10 @@ Error BitcodeReader::parseFunctionRecord(ArrayRef<uint64_t> Record) {
Type *PTy = cast<FunctionType>(FullFTy)->getParamType(i);
Type *PtrEltTy = getPointerElementFlatType(PTy);
- Attribute NewAttr;
- switch (Kind) {
- case Attribute::ByVal:
- NewAttr = Attribute::getWithByValType(Context, PtrEltTy);
- break;
- case Attribute::StructRet:
- NewAttr = Attribute::getWithStructRetType(Context, PtrEltTy);
- break;
- case Attribute::InAlloca:
- NewAttr = Attribute::getWithInAllocaType(Context, PtrEltTy);
- break;
- default:
- llvm_unreachable("not an upgraded type attribute");
- }
-
+ Attribute NewAttr =
+ Kind == Attribute::ByVal
+ ? Attribute::getWithByValType(Context, PtrEltTy)
+ : Attribute::getWithStructRetType(Context, PtrEltTy);
Func->addParamAttr(i, NewAttr);
}
}
@@ -3821,29 +3805,17 @@ Error BitcodeReader::typeCheckLoadStoreInst(Type *ValType, Type *PtrType) {
void BitcodeReader::propagateByValSRetTypes(CallBase *CB,
ArrayRef<Type *> ArgsFullTys) {
for (unsigned i = 0; i != CB->arg_size(); ++i) {
- for (Attribute::AttrKind Kind : {Attribute::ByVal, Attribute::StructRet,
- Attribute::InAlloca}) {
+ for (Attribute::AttrKind Kind : {Attribute::ByVal, Attribute::StructRet}) {
if (!CB->paramHasAttr(i, Kind))
continue;
CB->removeParamAttr(i, Kind);
Type *PtrEltTy = getPointerElementFlatType(ArgsFullTys[i]);
- Attribute NewAttr;
- switch (Kind) {
- case Attribute::ByVal:
- NewAttr = Attribute::getWithByValType(Context, PtrEltTy);
- break;
- case Attribute::StructRet:
- NewAttr = Attribute::getWithStructRetType(Context, PtrEltTy);
- break;
- case Attribute::InAlloca:
- NewAttr = Attribute::getWithInAllocaType(Context, PtrEltTy);
- break;
- default:
- llvm_unreachable("not an upgraded type attribute");
- }
-
+ Attribute NewAttr =
+ Kind == Attribute::ByVal
+ ? Attribute::getWithByValType(Context, PtrEltTy)
+ : Attribute::getWithStructRetType(Context, PtrEltTy);
CB->addParamAttr(i, NewAttr);
}
}