From 62e46f262158e2a6ea9c1c458f52633bb40a8590 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Mon, 27 Feb 2023 20:16:07 +0000 Subject: [LLVM] Remove support for constant scalable vector GEPs. This work has fallen out from D134648 as a requirement to loosen the "constness" of vscale. Differential Revision: https://reviews.llvm.org/D145404 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') 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 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()); -- cgit v1.1