Skip to content

Commit 57b4b4b

Browse files
authored
GH-47469: [C++][Gandiva] Add support for LLVM 21.1.0 (#47473)
### Rationale for this change LLVM 21.1 was released and some of our CI jobs are failing. ### What changes are included in this PR? * Accept LLVM 21.1 * Don't use deprecated API Two of the related commits that changed APIs on LLVM are: - llvm/llvm-project@034f2b3 - llvm/llvm-project@b18e5b6 ### Are these changes tested? Yes on CI ### Are there any user-facing changes? No * GitHub Issue: #47469 Authored-by: Raúl Cumplido <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent 427caf0 commit 57b4b4b

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}")
177177
set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support")
178178

179179
set(ARROW_LLVM_VERSIONS
180+
"21.1"
180181
"20.1"
181182
"19.1"
182183
"18.1"

cpp/src/gandiva/engine.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,16 @@ Status UseJITLinkIfEnabled(llvm::orc::LLJITBuilder& jit_builder) {
202202
static auto maybe_use_jit_link = ::arrow::internal::GetEnvVar("GANDIVA_USE_JIT_LINK");
203203
if (maybe_use_jit_link.ok()) {
204204
ARROW_ASSIGN_OR_RAISE(static auto memory_manager, CreateMemmoryManager());
205+
# if LLVM_VERSION_MAJOR >= 21
206+
jit_builder.setObjectLinkingLayerCreator([&](llvm::orc::ExecutionSession& ES) {
207+
return std::make_unique<llvm::orc::ObjectLinkingLayer>(ES, *memory_manager);
208+
});
209+
# else
205210
jit_builder.setObjectLinkingLayerCreator(
206211
[&](llvm::orc::ExecutionSession& ES, const llvm::Triple& TT) {
207212
return std::make_unique<llvm::orc::ObjectLinkingLayer>(ES, *memory_manager);
208213
});
214+
# endif
209215
}
210216
return Status::OK();
211217
}

cpp/src/gandiva/llvm_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ class GANDIVA_EXPORT LLVMTypes {
5656
llvm::Type* double_type() { return llvm::Type::getDoubleTy(context_); }
5757

5858
llvm::PointerType* ptr_type(llvm::Type* type) {
59+
#if LLVM_VERSION_MAJOR >= 21
60+
return llvm::PointerType::get(context_, 0);
61+
#else
5962
return llvm::PointerType::get(type, 0);
63+
#endif
6064
}
6165

6266
llvm::PointerType* i8_ptr_type() { return ptr_type(i8_type()); }

0 commit comments

Comments
 (0)