[PATCH] D142699: [AsmParser] Avoid instantiating LLVMContext if not needed. NFC
Jannik Silvanus via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 27 02:44:05 PST 2023
jsilvanus added inline comments.
================
Comment at: llvm/lib/AsmParser/Parser.cpp:36
+ return LLParser(F.getBuffer(), SM, Err, M, Index, Context, Slots)
.Run(UpgradeDebugInfo, DataLayoutCallback);
}
----------------
Instead of duplicating the call, maybe you can do something like
```
std::optional<LLVMContext> OptContext;
return LLParser(F.getBuffer(), SM, Err, M, Index,
M ? M->getContext() : OptContext.emplace(), Slots)
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142699/new/
https://reviews.llvm.org/D142699
More information about the llvm-commits
mailing list