aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-10-05 12:26:07 +0200
committerNikita Popov <npopov@redhat.com>2023-10-05 14:38:25 +0200
commit236228f43d018ebf11697610fe6504c167ed6ac8 (patch)
treeb6155bfade22191a5ae6d29010afde1a62e69346 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent2ca30eb8fdb186a775787a3931adb86ff5d86417 (diff)
downloadllvm-236228f43d018ebf11697610fe6504c167ed6ac8.zip
llvm-236228f43d018ebf11697610fe6504c167ed6ac8.tar.gz
llvm-236228f43d018ebf11697610fe6504c167ed6ac8.tar.bz2
[BitcodeReader] Replace unsupported constexprs in metadata with undef
Metadata (via ValueAsMetadata) can reference constant expressions that may no longer be supported. These references can both be in function-local metadata and module metadata, if the same expression is used in multiple functions. At least in theory, such references could also be in metadata proper, rather than just inside ValueAsMetadata references in calls. Instead of trying to expand these expressions (which we can't reliably do), pretend that the constant has been deleted, which means that ValueAsMetadata references will get replaced with undef metadata. Fixes https://github.com/llvm/llvm-project/issues/68281.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index e562918..1d1ec98 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -4683,7 +4683,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
case bitc::METADATA_BLOCK_ID:
assert(DeferredMetadataInfo.empty() &&
"Must read all module-level metadata before function-level");
- if (Error Err = MDLoader->parseFunctionMetadata(CurBB))
+ if (Error Err = MDLoader->parseFunctionMetadata())
return Err;
break;
case bitc::USELIST_BLOCK_ID: