[Orc] Honor hasJIT in JITTargetMachineBuilder::createTargetMachine
authorRainer Orth <ro@gcc.gnu.org>
Fri, 15 Jul 2022 06:20:57 +0000 (08:20 +0200)
committerRainer Orth <ro@gcc.gnu.org>
Fri, 15 Jul 2022 06:20:57 +0000 (08:20 +0200)
Even with D129349 <https://reviews.llvm.org/D129349>, various SPARC JIT
tests still `FAIL`.  They are guarded by `host-supports-jit`.  This is set
from `clang-repl --host-supports-jit` which still returns `true`.  It turns
out the `JITTargetMachineBuilder` doesn't consider `hasJIT` at all.

This patch corrects this, turning the affected tests `UNSUPPORTED`.

Tested on `sparcv9-sun-solaris2.11`.

Differential Revision: https://reviews.llvm.org/D129350

llvm/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp

index c60f4b3..70a3c40 100644 (file)
@@ -48,6 +48,10 @@ JITTargetMachineBuilder::createTargetMachine() {
   if (!TheTarget)
     return make_error<StringError>(std::move(ErrMsg), inconvertibleErrorCode());
 
+  if (!TheTarget->hasJIT())
+    return make_error<StringError>("Target has no JIT support",
+                                   inconvertibleErrorCode());
+
   auto *TM =
       TheTarget->createTargetMachine(TT.getTriple(), CPU, Features.getString(),
                                      Options, RM, CM, OptLevel, /*JIT*/ true);