diff options
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 2c1f195..dd75542 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1399,7 +1399,9 @@ unsigned BitcodeReader::getVirtualTypeID(Type *Ty, return TypeID; } -static bool isConstExprSupported(uint8_t Opcode) { +static bool isConstExprSupported(const BitcodeConstant *BC) { + uint8_t Opcode = BC->Opcode; + // These are not real constant expressions, always consider them supported. if (Opcode >= BitcodeConstant::FirstSpecialOpcode) return true; @@ -1412,6 +1414,9 @@ static bool isConstExprSupported(uint8_t Opcode) { if (Instruction::isBinaryOp(Opcode)) return ConstantExpr::isSupportedBinOp(Opcode); + if (Opcode == Instruction::GetElementPtr) + return ConstantExpr::isSupportedGetElementPtr(BC->SrcElemTy); + return Opcode != Instruction::FNeg; } @@ -1467,7 +1472,7 @@ Expected<Value *> BitcodeReader::materializeValue(unsigned StartValID, ConstOps.push_back(C); // Materialize as constant expression if possible. - if (isConstExprSupported(BC->Opcode) && ConstOps.size() == Ops.size()) { + if (isConstExprSupported(BC) && ConstOps.size() == Ops.size()) { Constant *C; if (Instruction::isCast(BC->Opcode)) { C = UpgradeBitCastExpr(BC->Opcode, ConstOps[0], BC->getType()); |