[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:31 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) {
+ for (Instruction &I : make_early_inc_range(BB)) {
+ I.eraseMetadataIf(Pred);
+
+ if (auto *II = dyn_cast<IntrinsicInst>(&I)) {
----------------
fhahn wrote:
nit: might be worth moving `II =...` out of the `if()` and use an early continue to reduce the nesting a bit.
https://github.com/llvm/llvm-project/pull/78421
More information about the llvm-commits
mailing list