[lld] [lld] check cache before real_path in loadDylib (PR #140791)

Vincent Lee via llvm-commits llvm-commits at lists.llvm.org
Fri May 23 01:16:09 PDT 2025


================
@@ -253,6 +265,7 @@ DylibFile *macho::loadDylib(MemoryBufferRef mbref, DylibFile *umbrella,
     }
     file =
         make<DylibFile>(**result, umbrella, isBundleLoader, explicitlyLinked);
+    realfile = file;
----------------
thevinster wrote:

What if we just use `realfile` everywhere? In the case when the pointers are the same, everything works as expected. But when they are different, the first cache lookup is basically always a miss and will rely on the second resolved path lookup to find the result. In theory, it shouldn't be a huge hit, but it's still a minor regression from the current implementation. But, it makes things easier to reason about without needing to set both `file` and `realfile`? 

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


More information about the llvm-commits mailing list