aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-09-07 12:46:32 +0200
committerNikita Popov <npopov@redhat.com>2022-09-07 12:47:21 +0200
commitd452d5e2de70a180e5af26dbda40cfb8b2506590 (patch)
tree8cda25df64463f7ddd78d10a4e7a57d233ccfb71 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent973fec78e935404fb5906a9abcd2f7848f17da62 (diff)
downloadllvm-d452d5e2de70a180e5af26dbda40cfb8b2506590.zip
llvm-d452d5e2de70a180e5af26dbda40cfb8b2506590.tar.gz
llvm-d452d5e2de70a180e5af26dbda40cfb8b2506590.tar.bz2
[Bitcode] Fix constexpr autoupgrade for arrays and structs
While vectors use insertelement, structs and arrays should use insertvalue.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 321f2b0..049fc0f 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1577,8 +1577,6 @@ Expected<Value *> BitcodeReader::materializeValue(unsigned StartValID,
I->setIsExact();
} else {
switch (BC->Opcode) {
- case BitcodeConstant::ConstantStructOpcode:
- case BitcodeConstant::ConstantArrayOpcode:
case BitcodeConstant::ConstantVectorOpcode: {
Type *IdxTy = Type::getInt32Ty(BC->getContext());
Value *V = PoisonValue::get(BC->getType());
@@ -1590,6 +1588,15 @@ Expected<Value *> BitcodeReader::materializeValue(unsigned StartValID,
I = cast<Instruction>(V);
break;
}
+ case BitcodeConstant::ConstantStructOpcode:
+ case BitcodeConstant::ConstantArrayOpcode: {
+ Value *V = PoisonValue::get(BC->getType());
+ for (auto Pair : enumerate(Ops))
+ V = InsertValueInst::Create(V, Pair.value(), Pair.index(),
+ "constexpr.ins", InsertBB);
+ I = cast<Instruction>(V);
+ break;
+ }
case Instruction::ICmp:
case Instruction::FCmp:
I = CmpInst::Create((Instruction::OtherOps)BC->Opcode,