[llvm] 7be783a - [ORC] Check for errors when materializing absolute symbols.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sat May 21 14:17:11 PDT 2022
Author: Lang Hames
Date: 2022-05-21T14:11:53-07:00
New Revision: 7be783ab9deb3ed035d6c3456afb1e630760433d
URL: https://github.com/llvm/llvm-project/commit/7be783ab9deb3ed035d6c3456afb1e630760433d
DIFF: https://github.com/llvm/llvm-project/commit/7be783ab9deb3ed035d6c3456afb1e630760433d.diff
LOG: [ORC] Check for errors when materializing absolute symbols.
This code previously used cantFail, but both steps (resolution and emission)
can fail if the resource tracker associated with the
AbsoluteSymbolsMaterializationUnit is removed. Checking these errors is
necessary for correct error propagation.
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 2fc3802e1851..9a90fe973da2 100644
--- a/llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -263,9 +263,21 @@ StringRef AbsoluteSymbolsMaterializationUnit::getName() const {
void AbsoluteSymbolsMaterializationUnit::materialize(
std::unique_ptr<MaterializationResponsibility> R) {
- // No dependencies, so these calls can't fail.
- cantFail(R->notifyResolved(Symbols));
- cantFail(R->notifyEmitted());
+ // Even though these are just absolute symbols we need to check for failure
+ // to resolve/emit: the tracker for these symbols may have been removed while
+ // the materialization was in flight (e.g. due to a failure in some action
+ // triggered by the queries attached to the resolution/emission of these
+ // symbols).
+ if (auto Err = R->notifyResolved(Symbols)) {
+ R->getExecutionSession().reportError(std::move(Err));
+ R->failMaterialization();
+ return;
+ }
+ if (auto Err = R->notifyEmitted()) {
+ R->getExecutionSession().reportError(std::move(Err));
+ R->failMaterialization();
+ return;
+ }
}
void AbsoluteSymbolsMaterializationUnit::discard(const JITDylib &JD,
More information about the llvm-commits
mailing list