aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2021-12-28 21:58:31 +0300
committerRoman Lebedev <lebedev.ri@gmail.com>2021-12-28 22:06:51 +0300
commitd5a4d6a4974a34092f161b0d23c3376e0f9e33ae (patch)
tree67527f66dd434bffaaf1fb5d7e9967e68d82ecfd /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent48207b2559c6b012ce167f2e76acea39e9d405cf (diff)
downloadllvm-d5a4d6a4974a34092f161b0d23c3376e0f9e33ae.zip
llvm-d5a4d6a4974a34092f161b0d23c3376e0f9e33ae.tar.gz
llvm-d5a4d6a4974a34092f161b0d23c3376e0f9e33ae.tar.bz2
[BitcodeReader] propagateAttributeTypes(): fix opaque pointer handling
Can't get the pointee type of an opaque pointer, but in that case said attributes must already be typed, so just don't try to rewrite them if they already are.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index f5a878f..1684f04 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3857,7 +3857,8 @@ void BitcodeReader::propagateAttributeTypes(CallBase *CB,
for (unsigned i = 0; i != CB->arg_size(); ++i) {
for (Attribute::AttrKind Kind : {Attribute::ByVal, Attribute::StructRet,
Attribute::InAlloca}) {
- if (!CB->paramHasAttr(i, Kind))
+ if (!CB->paramHasAttr(i, Kind) ||
+ CB->getParamAttr(i, Kind).getValueAsType())
continue;
CB->removeParamAttr(i, Kind);