aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-03-11 10:38:00 +0100
committerNikita Popov <npopov@redhat.com>2022-03-11 10:56:43 +0100
commitd7645f4ef866059da66442308c4c015c55b84e02 (patch)
treef750cea0b3b742ae058f8bc8457d9e9cba8463e1 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent5c3861b2772c518645419667839febd23035e38f (diff)
downloadllvm-d7645f4ef866059da66442308c4c015c55b84e02.zip
llvm-d7645f4ef866059da66442308c4c015c55b84e02.tar.gz
llvm-d7645f4ef866059da66442308c4c015c55b84e02.tar.bz2
[Bitcode] Delete instruction on error
As these errors are detected after the instruction has already been created (but before it has been inserted into the function), we also need to delete it.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 6a3012d..63b084c 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -5076,8 +5076,10 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
cast<InvokeInst>(I)->setCallingConv(
static_cast<CallingConv::ID>(CallingConv::MaxID & CCInfo));
cast<InvokeInst>(I)->setAttributes(PAL);
- if (Error Err = propagateAttributeTypes(cast<CallBase>(I), ArgTyIDs))
+ if (Error Err = propagateAttributeTypes(cast<CallBase>(I), ArgTyIDs)) {
+ I->deleteValue();
return Err;
+ }
break;
}
@@ -5171,8 +5173,10 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
cast<CallBrInst>(I)->setCallingConv(
static_cast<CallingConv::ID>((0x7ff & CCInfo) >> bitc::CALL_CCONV));
cast<CallBrInst>(I)->setAttributes(PAL);
- if (Error Err = propagateAttributeTypes(cast<CallBase>(I), ArgTyIDs))
+ if (Error Err = propagateAttributeTypes(cast<CallBase>(I), ArgTyIDs)) {
+ I->deleteValue();
return Err;
+ }
break;
}
case bitc::FUNC_CODE_INST_UNREACHABLE: // UNREACHABLE
@@ -5784,8 +5788,10 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
TCK = CallInst::TCK_NoTail;
cast<CallInst>(I)->setTailCallKind(TCK);
cast<CallInst>(I)->setAttributes(PAL);
- if (Error Err = propagateAttributeTypes(cast<CallBase>(I), ArgTyIDs))
+ if (Error Err = propagateAttributeTypes(cast<CallBase>(I), ArgTyIDs)) {
+ I->deleteValue();
return Err;
+ }
if (FMF.any()) {
if (!isa<FPMathOperator>(I))
return error("Fast-math-flags specified for call without "