[lld] [llvm] [LLD][COFF] Prefetch inputs early-on to improve link times (PR #169224)

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 1 02:04:09 PST 2025


================
@@ -1023,6 +1023,30 @@ void mapped_file_region::unmapImpl() {
 
 void mapped_file_region::dontNeedImpl() {}
 
+void mapped_file_region::willNeedImpl() {
+  HMODULE kernelM = llvm::sys::windows::loadSystemModuleSecure(L"kernel32.dll");
----------------
zmodem wrote:

I suppose we only need this when initializing `pfnPrefetchVirtualMemory`, which we only do once because it's static. So perhaps this should also be static and only initialized once?

Or maybe `pfnPrefetchVirtualMemory` could be initialized by a lambda that does both the `loadSystemModuleSecure` and `GetProcAddress` calls?

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


More information about the llvm-commits mailing list