[llvm] 3ce1e94 - [ORC] Add early-out to OL_applyQueryPhase1.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 14 15:01:09 PST 2021
Author: Lang Hames
Date: 2021-12-15T10:01:02+11:00
New Revision: 3ce1e9428b96339c516da926657f830bfb4d4c9a
URL: https://github.com/llvm/llvm-project/commit/3ce1e9428b96339c516da926657f830bfb4d4c9a
DIFF: https://github.com/llvm/llvm-project/commit/3ce1e9428b96339c516da926657f830bfb4d4c9a.diff
LOG: [ORC] Add early-out to OL_applyQueryPhase1.
If all symbols in a lookup match before we reach the end of the search order
then bail out of the search-order loop early.
This should reduce unnecessary contention on the session lock and improve
readability of the debug logs.
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/Core.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp
index b06dff1260638..aa82cf38c45db 100644
--- a/llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -2491,10 +2491,19 @@ void ExecutionSession::OL_applyQueryPhase1(
}
}
- // If we get here then we've moved on to the next JITDylib.
- LLVM_DEBUG(dbgs() << "Phase 1 moving to next JITDylib.\n");
- ++IPLS->CurSearchOrderIndex;
- IPLS->NewJITDylib = true;
+ if (IPLS->DefGeneratorCandidates.empty() &&
+ IPLS->DefGeneratorNonCandidates.empty()) {
+ // Early out if there are no remaining symbols.
+ LLVM_DEBUG(dbgs() << "All symbols matched.\n");
+ IPLS->CurSearchOrderIndex = IPLS->SearchOrder.size();
+ break;
+ } else {
+ // If we get here then we've moved on to the next JITDylib with candidates
+ // remaining.
+ LLVM_DEBUG(dbgs() << "Phase 1 moving to next JITDylib.\n");
+ ++IPLS->CurSearchOrderIndex;
+ IPLS->NewJITDylib = true;
+ }
}
// Remove any weakly referenced candidates that could not be found/generated.
More information about the llvm-commits
mailing list