Skip to content

Commit f3e683d

Browse files
maleadtvtjnash
andcommitted
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 ac2593a commit f3e683d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/codegen.cpp

+3-8
Original file line numberDiff line numberDiff line change
@@ -9196,17 +9196,12 @@ extern "C" void jl_init_llvm(void)
91969196
if (clopt && clopt->getNumOccurrences() == 0)
91979197
cl::ProvidePositionalOption(clopt, "4", 1);
91989198

9199-
#if JL_LLVM_VERSION >= 150000
9199+
// we want the opaque-pointers to be opt-in, per LLVMContext, for this release
9200+
// so change the default value back to pre-14.x, without changing the NumOccurrences flag for it
92009201
clopt = llvmopts.lookup("opaque-pointers");
92019202
if (clopt && clopt->getNumOccurrences() == 0) {
9202-
#ifdef JL_LLVM_OPAQUE_POINTERS
9203-
cl::ProvidePositionalOption(clopt, "true", 1);
9204-
#else
9205-
cl::ProvidePositionalOption(clopt, "false", 1);
9206-
#endif
9203+
clopt->addOccurrence(1, clopt->ArgStr, "false", true);
92079204
}
9208-
#endif
9209-
92109205
jl_ExecutionEngine = new JuliaOJIT();
92119206

92129207
bool jl_using_gdb_jitevents = false;

src/jitlayers.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,12 @@ JuliaOJIT::JuliaOJIT()
13291329
ExternalJD(ES.createBareJITDylib("JuliaExternal")),
13301330
ContextPool([](){
13311331
auto ctx = std::make_unique<LLVMContext>();
1332+
if (!ctx->hasSetOpaquePointersValue())
1333+
#ifndef JL_LLVM_OPAQUE_POINTERS
1334+
ctx->setOpaquePointers(false);
1335+
#else
1336+
ctx->setOpaquePointers(true);
1337+
#endif
13321338
return orc::ThreadSafeContext(std::move(ctx));
13331339
}),
13341340
#ifdef JL_USE_JITLINK

0 commit comments

Comments
 (0)