aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Gränitz <stefan.graenitz@gmail.com>2023-12-08 22:10:03 +0100
committerGitHub <noreply@github.com>2023-12-08 22:10:03 +0100
commitd86a93782f4ea476b7fa6751f849fb4ada3df852 (patch)
tree8f12d2f5a778a9bbb1be97e74a803ac7ea3d1612
parente837ef91e327d1d183750879385090db800e5e59 (diff)
downloadllvm-d86a93782f4ea476b7fa6751f849fb4ada3df852.zip
llvm-d86a93782f4ea476b7fa6751f849fb4ada3df852.tar.gz
llvm-d86a93782f4ea476b7fa6751f849fb4ada3df852.tar.bz2
[Orc][examples] Drop target triple from input for remote debugging test (#74831)
https://github.com/llvm/llvm-project/pull/74764 reported that the `lljit-with-remote-debugging` test fails on AArch64 hosts, because the input IR file states arch x86_64 explicitly. In order to drop the target triple we have to remove a check in the example implementation. Not sure it's fully portable now, but at least it's better than before.
-rw-r--r--llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp16
-rw-r--r--llvm/test/Examples/OrcV2Examples/Inputs/argc_sub1_elf.ll1
2 files changed, 4 insertions, 13 deletions
diff --git a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp
index 291f14e..9001125 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp
@@ -88,6 +88,7 @@
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/TargetParser/Host.h"
#include "../ExampleModules.h"
#include "RemoteJITUtils.h"
@@ -173,24 +174,15 @@ int main(int argc, char *argv[]) {
TSMs.push_back(ExitOnErr(parseExampleModuleFromFile(Path)));
}
- StringRef TT;
+ std::string TT;
StringRef MainModuleName;
TSMs.front().withModuleDo([&MainModuleName, &TT](Module &M) {
MainModuleName = M.getName();
TT = M.getTargetTriple();
+ if (TT.empty())
+ TT = sys::getProcessTriple();
});
- for (const ThreadSafeModule &TSM : TSMs)
- ExitOnErr(TSM.withModuleDo([TT, MainModuleName](Module &M) -> Error {
- if (M.getTargetTriple() != TT)
- return make_error<StringError>(
- formatv("Different target triples in input files:\n"
- " '{0}' in '{1}'\n '{2}' in '{3}'",
- TT, MainModuleName, M.getTargetTriple(), M.getName()),
- inconvertibleErrorCode());
- return Error::success();
- }));
-
// Create a target machine that matches the input triple.
JITTargetMachineBuilder JTMB((Triple(TT)));
JTMB.setCodeModel(CodeModel::Small);
diff --git a/llvm/test/Examples/OrcV2Examples/Inputs/argc_sub1_elf.ll b/llvm/test/Examples/OrcV2Examples/Inputs/argc_sub1_elf.ll
index 659dbe1..0cdc5e7 100644
--- a/llvm/test/Examples/OrcV2Examples/Inputs/argc_sub1_elf.ll
+++ b/llvm/test/Examples/OrcV2Examples/Inputs/argc_sub1_elf.ll
@@ -1,5 +1,4 @@
; ModuleID = 'argc_sub1.c'
-target triple = "x86_64-unknown-unknown-elf"
define i32 @sub1(i32) !dbg !8 {
call void @llvm.dbg.value(metadata i32 %0, metadata !13, metadata !DIExpression()), !dbg !14