summaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Metadata.cpp
diff options
context:
space:
mode:
authorOCHyams <orlando.hyams@sony.com>2022-11-09 10:49:55 +0000
committerOCHyams <orlando.hyams@sony.com>2022-11-09 10:49:55 +0000
commit02f50d05d5fea4e9c5fac310abccc5f7d770b25b (patch)
treed6673f08a185e87b002c0129c7acdc41bf238ba6 /llvm/lib/IR/Metadata.cpp
parenta9025f57bac1121a2aa5ac05f48f611cd2b3a64f (diff)
[Assignment Tracking][9/*] Don't drop DIAssignID in dropUnknownNonDebugMetadata
The Assignment Tracking debug-info feature is outlined in this RFC: https://discourse.llvm.org/t/ rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir A DIAssignID attachment is debug metadata, so don't drop it. Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D133292
Diffstat (limited to 'llvm/lib/IR/Metadata.cpp')
-rw-r--r--llvm/lib/IR/Metadata.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 533690203189..bde83717ebef 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -1403,15 +1403,12 @@ void Instruction::dropUnknownNonDebugMetadata(ArrayRef<unsigned> KnownIDs) {
if (!Value::hasMetadata())
return; // Nothing to remove!
- if (KnownIDs.empty()) {
- // Just drop our entry at the store.
- clearMetadata();
- return;
- }
-
SmallSet<unsigned, 4> KnownSet;
KnownSet.insert(KnownIDs.begin(), KnownIDs.end());
+ // A DIAssignID attachment is debug metadata, don't drop it.
+ KnownSet.insert(LLVMContext::MD_DIAssignID);
+
auto &MetadataStore = getContext().pImpl->ValueMetadata;
auto &Info = MetadataStore[this];
assert(!Info.empty() && "bit out of sync with hash table");