From 1271b8f57ab95b601b75b69cd957b9ee9f0c186c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 29 Jun 2022 14:16:30 +0200 Subject: [Bitcode] Restore bitcast expression auto-upgrade Restore the autoupgrade from bitcast to ptrtoint+inttoptr, which was lost as part of D127729. This fixes the backwards compatibility issue noted in: https://reviews.llvm.org/D127729#inline-1236519 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (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 7abe7c0..5e5ca96 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1442,7 +1442,9 @@ Expected BitcodeReader::materializeValue(unsigned StartValID, if (isConstExprSupported(BC->Opcode) && ConstOps.size() == Ops.size()) { Constant *C; if (Instruction::isCast(BC->Opcode)) { - C = ConstantExpr::getCast(BC->Opcode, ConstOps[0], BC->getType()); + C = UpgradeBitCastExpr(BC->Opcode, ConstOps[0], BC->getType()); + if (!C) + C = ConstantExpr::getCast(BC->Opcode, ConstOps[0], BC->getType()); } else if (Instruction::isUnaryOp(BC->Opcode)) { C = ConstantExpr::get(BC->Opcode, ConstOps[0], BC->Flags); } else if (Instruction::isBinaryOp(BC->Opcode)) { -- cgit v1.1