[llvm] [AsmParser] Add support for reading incomplete IR (part 1) (PR #78421)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 01:55:30 PST 2024


================
@@ -123,6 +130,57 @@ void LLParser::restoreParsingState(const SlotMapping *Slots) {
         std::make_pair(I.first, std::make_pair(I.second, LocTy())));
 }
 
+void LLParser::dropUnknownMetadataReferences() {
+  auto Pred = [](unsigned MDKind, MDNode *Node) { return Node->isTemporary(); };
+  for (Function &F : *M) {
+    F.eraseMetadataIf(Pred);
+    for (BasicBlock &BB : F) {
----------------
fhahn wrote:

nit: maybe use `InstIterator` to iterate over all instructions in the function, to reduce indentation?

https://github.com/llvm/llvm-project/pull/78421


More information about the llvm-commits mailing list