Skip to content

Commit 3493473

Browse files
maleadtvtjnash
andauthored
LLVM: Activate typed pointers through the API instead of a global option. (#51840)
This allows other users of LLVM to use opaque pointers with their contexts. Co-authored-by: Jameson Nash <vtjnash@gmail.com>
1 parent 1705fe8 commit 3493473

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/codegen.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9310,17 +9310,12 @@ extern "C" void jl_init_llvm(void)
93109310
if (clopt && clopt->getNumOccurrences() == 0)
93119311
cl::ProvidePositionalOption(clopt, "4", 1);
93129312

9313-
#if JL_LLVM_VERSION >= 150000
9313+
// we want the opaque-pointers to be opt-in, per LLVMContext, for this release
9314+
// so change the default value back to pre-14.x, without changing the NumOccurrences flag for it
93149315
clopt = llvmopts.lookup("opaque-pointers");
93159316
if (clopt && clopt->getNumOccurrences() == 0) {
9316-
#ifdef JL_LLVM_OPAQUE_POINTERS
9317-
cl::ProvidePositionalOption(clopt, "true", 1);
9318-
#else
9319-
cl::ProvidePositionalOption(clopt, "false", 1);
9320-
#endif
9317+
clopt->addOccurrence(1, clopt->ArgStr, "false", true);
93219318
}
9322-
#endif
9323-
93249319
jl_ExecutionEngine = new JuliaOJIT();
93259320

93269321
bool jl_using_gdb_jitevents = false;

src/jitlayers.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,6 +1629,12 @@ JuliaOJIT::JuliaOJIT()
16291629
DLSymOpt(std::make_unique<DLSymOptimizer>(false)),
16301630
ContextPool([](){
16311631
auto ctx = std::make_unique<LLVMContext>();
1632+
if (!ctx->hasSetOpaquePointersValue())
1633+
#ifndef JL_LLVM_OPAQUE_POINTERS
1634+
ctx->setOpaquePointers(false);
1635+
#else
1636+
ctx->setOpaquePointers(true);
1637+
#endif
16321638
return orc::ThreadSafeContext(std::move(ctx));
16331639
}),
16341640
#ifdef JL_USE_JITLINK

0 commit comments

Comments
 (0)