[llvm] 624dcd8 - [lli] Honor -mtriple option in -jit-kind=orc mode.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue May 9 23:35:45 PDT 2023
Author: Lang Hames
Date: 2023-05-09T23:35:38-07:00
New Revision: 624dcd8d53c1ffe10fbc936b186a98ec7fa1c865
URL: https://github.com/llvm/llvm-project/commit/624dcd8d53c1ffe10fbc936b186a98ec7fa1c865
DIFF: https://github.com/llvm/llvm-project/commit/624dcd8d53c1ffe10fbc936b186a98ec7fa1c865.diff
LOG: [lli] Honor -mtriple option in -jit-kind=orc mode.
Useful for lli debugging / experiments. See, for example, discussion at
https://reviews.llvm.org/D149996.
Added:
Modified:
llvm/tools/lli/lli.cpp
Removed:
################################################################################
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index 33b2bf869893..390b9989a838 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -845,17 +845,24 @@ int runOrcJIT(const char *ProgName) {
orc::ThreadSafeContext TSCtx(std::make_unique<LLVMContext>());
auto MainModule = ExitOnErr(loadModule(InputFile, TSCtx));
- // Get TargetTriple and DataLayout from the main module if they're explicitly
- // set.
+ // If -mtriple option is given then use it, otherwise take the triple from
+ // the main module if it's present.
std::optional<Triple> TT;
- std::optional<DataLayout> DL;
- MainModule.withModuleDo([&](Module &M) {
+ if (!TargetTriple.empty())
+ TT = Triple(TargetTriple);
+ else
+ MainModule.withModuleDo([&](Module &M) {
if (!M.getTargetTriple().empty())
TT = Triple(M.getTargetTriple());
- if (!M.getDataLayout().isDefault())
- DL = M.getDataLayout();
});
+ // Get the DataLayout from the main module if it's explicitly set.
+ std::optional<DataLayout> DL;
+ MainModule.withModuleDo([&](Module &M) {
+ if (!M.getDataLayout().isDefault())
+ DL = M.getDataLayout();
+ });
+
orc::LLLazyJITBuilder Builder;
Builder.setJITTargetMachineBuilder(
More information about the llvm-commits
mailing list