Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ci/scripts/msys2_setup.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@ case "${target}" in
packages+=(${MINGW_PACKAGE_PREFIX}-llvm)
packages+=(${MINGW_PACKAGE_PREFIX}-lz4)
packages+=(${MINGW_PACKAGE_PREFIX}-make)
packages+=(${MINGW_PACKAGE_PREFIX}-mlir)
packages+=(${MINGW_PACKAGE_PREFIX}-ninja)
packages+=(${MINGW_PACKAGE_PREFIX}-polly)
packages+=(${MINGW_PACKAGE_PREFIX}-protobuf)
Expand All@@ -60,7 +61,7 @@ case "${target}" in
;;
esac

case "${target}" in
case "${target}" in
cgo)
packages+=(${MINGW_PACKAGE_PREFIX}-arrow)
packages+=(${MINGW_PACKAGE_PREFIX}-gcc)
Expand Down
2 changes: 1 addition & 1 deletion cpp/Brewfile
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ brew "flatbuffers"
brew "git"
brew "glog"
brew "grpc"
brew "llvm@12"
brew "llvm"
brew "llvm@8"
brew "lz4"
brew "minio"
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}")

set(ARROW_LLVM_VERSIONS
"13.0"
"12.0"
"11.1"
"11.0"
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/gandiva/decimal_ir.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,8 +96,8 @@ void DecimalIR::InitializeIntrinsics() {
// CPP: return kScaleMultipliers[scale]
llvm::Value* DecimalIR::GetScaleMultiplier(llvm::Value* scale) {
auto const_array = module()->getGlobalVariable(kScaleMultipliersName);
auto ptr = ir_builder()->CreateGEP(const_array, {types()->i32_constant(0), scale});
return ir_builder()->CreateLoad(ptr);
auto ptr = CreateGEP(ir_builder(), const_array, {types()->i32_constant(0), scale});
return CreateLoad(ir_builder(), ptr);
}

// CPP: x <= y ? y : x
Expand DownExpand Up@@ -248,8 +248,8 @@ llvm::Value* DecimalIR::AddLarge(const ValueFull& x, const ValueFull& y,
ir_builder()->CreateCall(module()->getFunction("add_large_decimal128_decimal128"),
args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
auto sum = ValueSplit(out_high, out_low).AsInt128(this);
ADD_TRACE_128("AddLarge : sum", sum);
return sum;
Expand DownExpand Up@@ -445,8 +445,8 @@ llvm::Value* DecimalIR::CallDecimalFunction(const std::string& function_name,
// Make call to pre-compiled IR function.
ir_builder()->CreateCall(module()->getFunction(function_name), dis_assembled_args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
result = ValueSplit(out_high, out_low).AsInt128(this);
} else {
DCHECK_NE(return_type, types()->void_type());
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/gandiva/engine_llvm_test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,8 +80,8 @@ class TestEngine : public ::testing::Test {
loop_var->addIncoming(loop_update, loop_body);

// get the current value
llvm::Value* offset = builder->CreateGEP(arg_elements, loop_var, "offset");
llvm::Value* current_value = builder->CreateLoad(offset, "value");
llvm::Value* offset = CreateGEP(builder, arg_elements, loop_var, "offset");
llvm::Value* current_value = CreateLoad(builder, offset, "value");

// setup sum PHI
llvm::Value* sum_update = builder->CreateAdd(sum, current_value, "sum+ith");
Expand Down
36 changes: 18 additions & 18 deletions cpp/src/gandiva/llvm_generator.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,8 +143,8 @@ Status LLVMGenerator::Execute(const arrow::RecordBatch& record_batch,
llvm::Value* LLVMGenerator::LoadVectorAtIndex(llvm::Value* arg_addrs, int idx,
const std::string& name) {
auto* idx_val = types()->i32_constant(idx);
auto* offset = ir_builder()->CreateGEP(arg_addrs, idx_val, name + "_mem_addr");
return ir_builder()->CreateLoad(offset, name + "_mem");
auto* offset = CreateGEP(ir_builder(), arg_addrs, idx_val, name + "_mem_addr");
return CreateLoad(ir_builder(), offset, name + "_mem");
}

/// Get reference to validity array at specified index in the args list.
Expand DownExpand Up@@ -314,8 +314,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,

std::vector<llvm::Value*> slice_offsets;
for (int idx = 0; idx < buffer_count; idx++) {
auto offsetAddr = builder->CreateGEP(arg_addr_offsets, types()->i32_constant(idx));
auto offset = builder->CreateLoad(offsetAddr);
auto offsetAddr = CreateGEP(builder, arg_addr_offsets, types()->i32_constant(idx));
auto offset = CreateLoad(builder, offsetAddr);
slice_offsets.push_back(offset);
}

Expand All@@ -328,8 +328,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
llvm::Value* position_var = loop_var;
if (selection_vector_mode != SelectionVector::MODE_NONE) {
position_var = builder->CreateIntCast(
builder->CreateLoad(builder->CreateGEP(arg_selection_vector, loop_var),
"uncasted_position_var"),
CreateLoad(builder, CreateGEP(builder, arg_selection_vector, loop_var),
"uncasted_position_var"),
types()->i64_type(), true, "position_var");
}

Expand All@@ -354,7 +354,7 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
SetPackedBitValue(output_ref, loop_var, output_value->data());
} else if (arrow::is_primitive(output_type_id) ||
output_type_id == arrow::Type::DECIMAL) {
llvm::Value* slot_offset = builder->CreateGEP(output_ref, loop_var);
llvm::Value* slot_offset = CreateGEP(builder, output_ref, loop_var);
builder->CreateStore(output_value->data(), slot_offset);
} else if (arrow::is_binary_like(output_type_id)) {
// Var-len output. Make a function call to populate the data.
Expand DownExpand Up@@ -550,15 +550,15 @@ void LLVMGenerator::Visitor::Visit(const VectorReadFixedLenValueDex& dex) {
break;

case arrow::Type::DECIMAL: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = generator_->BuildDecimalLValue(slot_value, dex.FieldType());
break;
}

default: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = std::make_shared<LValue>(slot_value);
break;
}
Expand All@@ -579,14 +579,14 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
builder->CreateAdd(loop_var_, GetSliceOffset(dex.OffsetsIdx()));

// => offset_start = offsets[loop_var]
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = builder->CreateLoad(slot, "offset_start");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = CreateLoad(builder, slot, "offset_start");

// => offset_end = offsets[loop_var + 1]
llvm::Value* offsets_slot_index_next = builder->CreateAdd(
offsets_slot_index, generator_->types()->i64_constant(1), "loop_var+1");
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = builder->CreateLoad(slot, "offset_end");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = CreateLoad(builder, slot, "offset_end");

// => len_value = offset_end - offset_start
llvm::Value* len_value =
Expand All@@ -595,7 +595,7 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
// get the data from the data array, at offset 'offset_start'.
llvm::Value* data_slot_ref =
GetBufferReference(dex.DataIdx(), kBufferTypeData, dex.Field());
llvm::Value* data_value = builder->CreateGEP(data_slot_ref, offset_start);
llvm::Value* data_value = CreateGEP(builder, data_slot_ref, offset_start);
ADD_VISITOR_TRACE("visit var-len data vector " + dex.FieldName() + " len %T",
len_value);
result_.reset(new LValue(data_value, len_value));
Expand DownExpand Up@@ -806,7 +806,7 @@ void LLVMGenerator::Visitor::Visit(const NullableInternalFuncDex& dex) {
result_ = BuildFunctionCall(native_function, arrow_return_type, &params);

// load the result validity and truncate to i1.
llvm::Value* result_valid_i8 = builder->CreateLoad(result_valid_ptr);
llvm::Value* result_valid_i8 = CreateLoad(builder, result_valid_ptr);
llvm::Value* result_valid = builder->CreateTrunc(result_valid_i8, types->i1_type());

// set validity bit in the local bitmap.
Expand DownExpand Up@@ -1221,7 +1221,7 @@ LValuePtr LLVMGenerator::Visitor::BuildFunctionCall(const NativeFunction* func,
? decimalIR.CallDecimalFunction(func->pc_name(), llvm_return_type, *params)
: generator_->AddFunctionCall(func->pc_name(), llvm_return_type, *params);
auto value_len =
(result_len_ptr == nullptr) ? nullptr : builder->CreateLoad(result_len_ptr);
(result_len_ptr == nullptr) ? nullptr : CreateLoad(builder, result_len_ptr);
return std::make_shared<LValue>(value, value_len);
}
}
Expand Down
13 changes: 13 additions & 0 deletions cpp/src/gandiva/llvm_includes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,3 +41,16 @@
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

// Workaround for deprecated builder methods as of LLVM 13: ARROW-14363
inline llvm::Value* CreateGEP(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
llvm::ArrayRef<llvm::Value*> IdxList,
const llvm::Twine& Name = "") {
return builder->CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(), Ptr,
IdxList, Name);
}

inline llvm::LoadInst* CreateLoad(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
const llvm::Twine& Name = "") {
return builder->CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name);
}
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
ARROW-14364: [CI][C++] Support LLVM 13 by kszucs · Pull Request #11448 · apache/arrow · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ci/scripts/msys2_setup.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@ case "${target}" in
packages+=(${MINGW_PACKAGE_PREFIX}-llvm)
packages+=(${MINGW_PACKAGE_PREFIX}-lz4)
packages+=(${MINGW_PACKAGE_PREFIX}-make)
packages+=(${MINGW_PACKAGE_PREFIX}-mlir)
packages+=(${MINGW_PACKAGE_PREFIX}-ninja)
packages+=(${MINGW_PACKAGE_PREFIX}-polly)
packages+=(${MINGW_PACKAGE_PREFIX}-protobuf)
Expand All@@ -60,7 +61,7 @@ case "${target}" in
;;
esac

case "${target}" in
case "${target}" in
cgo)
packages+=(${MINGW_PACKAGE_PREFIX}-arrow)
packages+=(${MINGW_PACKAGE_PREFIX}-gcc)
Expand Down
2 changes: 1 addition & 1 deletion cpp/Brewfile
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ brew "flatbuffers"
brew "git"
brew "glog"
brew "grpc"
brew "llvm@12"
brew "llvm"
brew "llvm@8"
brew "lz4"
brew "minio"
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}")

set(ARROW_LLVM_VERSIONS
"13.0"
"12.0"
"11.1"
"11.0"
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/gandiva/decimal_ir.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,8 +96,8 @@ void DecimalIR::InitializeIntrinsics() {
// CPP: return kScaleMultipliers[scale]
llvm::Value* DecimalIR::GetScaleMultiplier(llvm::Value* scale) {
auto const_array = module()->getGlobalVariable(kScaleMultipliersName);
auto ptr = ir_builder()->CreateGEP(const_array, {types()->i32_constant(0), scale});
return ir_builder()->CreateLoad(ptr);
auto ptr = CreateGEP(ir_builder(), const_array, {types()->i32_constant(0), scale});
return CreateLoad(ir_builder(), ptr);
}

// CPP: x <= y ? y : x
Expand DownExpand Up@@ -248,8 +248,8 @@ llvm::Value* DecimalIR::AddLarge(const ValueFull& x, const ValueFull& y,
ir_builder()->CreateCall(module()->getFunction("add_large_decimal128_decimal128"),
args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
auto sum = ValueSplit(out_high, out_low).AsInt128(this);
ADD_TRACE_128("AddLarge : sum", sum);
return sum;
Expand DownExpand Up@@ -445,8 +445,8 @@ llvm::Value* DecimalIR::CallDecimalFunction(const std::string& function_name,
// Make call to pre-compiled IR function.
ir_builder()->CreateCall(module()->getFunction(function_name), dis_assembled_args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
result = ValueSplit(out_high, out_low).AsInt128(this);
} else {
DCHECK_NE(return_type, types()->void_type());
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/gandiva/engine_llvm_test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,8 +80,8 @@ class TestEngine : public ::testing::Test {
loop_var->addIncoming(loop_update, loop_body);

// get the current value
llvm::Value* offset = builder->CreateGEP(arg_elements, loop_var, "offset");
llvm::Value* current_value = builder->CreateLoad(offset, "value");
llvm::Value* offset = CreateGEP(builder, arg_elements, loop_var, "offset");
llvm::Value* current_value = CreateLoad(builder, offset, "value");

// setup sum PHI
llvm::Value* sum_update = builder->CreateAdd(sum, current_value, "sum+ith");
Expand Down
36 changes: 18 additions & 18 deletions cpp/src/gandiva/llvm_generator.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,8 +143,8 @@ Status LLVMGenerator::Execute(const arrow::RecordBatch& record_batch,
llvm::Value* LLVMGenerator::LoadVectorAtIndex(llvm::Value* arg_addrs, int idx,
const std::string& name) {
auto* idx_val = types()->i32_constant(idx);
auto* offset = ir_builder()->CreateGEP(arg_addrs, idx_val, name + "_mem_addr");
return ir_builder()->CreateLoad(offset, name + "_mem");
auto* offset = CreateGEP(ir_builder(), arg_addrs, idx_val, name + "_mem_addr");
return CreateLoad(ir_builder(), offset, name + "_mem");
}

/// Get reference to validity array at specified index in the args list.
Expand DownExpand Up@@ -314,8 +314,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,

std::vector<llvm::Value*> slice_offsets;
for (int idx = 0; idx < buffer_count; idx++) {
auto offsetAddr = builder->CreateGEP(arg_addr_offsets, types()->i32_constant(idx));
auto offset = builder->CreateLoad(offsetAddr);
auto offsetAddr = CreateGEP(builder, arg_addr_offsets, types()->i32_constant(idx));
auto offset = CreateLoad(builder, offsetAddr);
slice_offsets.push_back(offset);
}

Expand All@@ -328,8 +328,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
llvm::Value* position_var = loop_var;
if (selection_vector_mode != SelectionVector::MODE_NONE) {
position_var = builder->CreateIntCast(
builder->CreateLoad(builder->CreateGEP(arg_selection_vector, loop_var),
"uncasted_position_var"),
CreateLoad(builder, CreateGEP(builder, arg_selection_vector, loop_var),
"uncasted_position_var"),
types()->i64_type(), true, "position_var");
}

Expand All@@ -354,7 +354,7 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
SetPackedBitValue(output_ref, loop_var, output_value->data());
} else if (arrow::is_primitive(output_type_id) ||
output_type_id == arrow::Type::DECIMAL) {
llvm::Value* slot_offset = builder->CreateGEP(output_ref, loop_var);
llvm::Value* slot_offset = CreateGEP(builder, output_ref, loop_var);
builder->CreateStore(output_value->data(), slot_offset);
} else if (arrow::is_binary_like(output_type_id)) {
// Var-len output. Make a function call to populate the data.
Expand DownExpand Up@@ -550,15 +550,15 @@ void LLVMGenerator::Visitor::Visit(const VectorReadFixedLenValueDex& dex) {
break;

case arrow::Type::DECIMAL: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = generator_->BuildDecimalLValue(slot_value, dex.FieldType());
break;
}

default: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = std::make_shared<LValue>(slot_value);
break;
}
Expand All@@ -579,14 +579,14 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
builder->CreateAdd(loop_var_, GetSliceOffset(dex.OffsetsIdx()));

// => offset_start = offsets[loop_var]
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = builder->CreateLoad(slot, "offset_start");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = CreateLoad(builder, slot, "offset_start");

// => offset_end = offsets[loop_var + 1]
llvm::Value* offsets_slot_index_next = builder->CreateAdd(
offsets_slot_index, generator_->types()->i64_constant(1), "loop_var+1");
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = builder->CreateLoad(slot, "offset_end");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = CreateLoad(builder, slot, "offset_end");

// => len_value = offset_end - offset_start
llvm::Value* len_value =
Expand All@@ -595,7 +595,7 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
// get the data from the data array, at offset 'offset_start'.
llvm::Value* data_slot_ref =
GetBufferReference(dex.DataIdx(), kBufferTypeData, dex.Field());
llvm::Value* data_value = builder->CreateGEP(data_slot_ref, offset_start);
llvm::Value* data_value = CreateGEP(builder, data_slot_ref, offset_start);
ADD_VISITOR_TRACE("visit var-len data vector " + dex.FieldName() + " len %T",
len_value);
result_.reset(new LValue(data_value, len_value));
Expand DownExpand Up@@ -806,7 +806,7 @@ void LLVMGenerator::Visitor::Visit(const NullableInternalFuncDex& dex) {
result_ = BuildFunctionCall(native_function, arrow_return_type, &params);

// load the result validity and truncate to i1.
llvm::Value* result_valid_i8 = builder->CreateLoad(result_valid_ptr);
llvm::Value* result_valid_i8 = CreateLoad(builder, result_valid_ptr);
llvm::Value* result_valid = builder->CreateTrunc(result_valid_i8, types->i1_type());

// set validity bit in the local bitmap.
Expand DownExpand Up@@ -1221,7 +1221,7 @@ LValuePtr LLVMGenerator::Visitor::BuildFunctionCall(const NativeFunction* func,
? decimalIR.CallDecimalFunction(func->pc_name(), llvm_return_type, *params)
: generator_->AddFunctionCall(func->pc_name(), llvm_return_type, *params);
auto value_len =
(result_len_ptr == nullptr) ? nullptr : builder->CreateLoad(result_len_ptr);
(result_len_ptr == nullptr) ? nullptr : CreateLoad(builder, result_len_ptr);
return std::make_shared<LValue>(value, value_len);
}
}
Expand Down
13 changes: 13 additions & 0 deletions cpp/src/gandiva/llvm_includes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,3 +41,16 @@
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

// Workaround for deprecated builder methods as of LLVM 13: ARROW-14363
inline llvm::Value* CreateGEP(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
llvm::ArrayRef<llvm::Value*> IdxList,
const llvm::Twine& Name = "") {
return builder->CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(), Ptr,
IdxList, Name);
}

inline llvm::LoadInst* CreateLoad(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
const llvm::Twine& Name = "") {
return builder->CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name);
}
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ARROW-14364: [CI][C++] Support LLVM 13 by kszucs · Pull Request #11448 · apache/arrow · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ci/scripts/msys2_setup.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@ case "${target}" in
packages+=(${MINGW_PACKAGE_PREFIX}-llvm)
packages+=(${MINGW_PACKAGE_PREFIX}-lz4)
packages+=(${MINGW_PACKAGE_PREFIX}-make)
packages+=(${MINGW_PACKAGE_PREFIX}-mlir)
packages+=(${MINGW_PACKAGE_PREFIX}-ninja)
packages+=(${MINGW_PACKAGE_PREFIX}-polly)
packages+=(${MINGW_PACKAGE_PREFIX}-protobuf)
Expand All@@ -60,7 +61,7 @@ case "${target}" in
;;
esac

case "${target}" in
case "${target}" in
cgo)
packages+=(${MINGW_PACKAGE_PREFIX}-arrow)
packages+=(${MINGW_PACKAGE_PREFIX}-gcc)
Expand Down
2 changes: 1 addition & 1 deletion cpp/Brewfile
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ brew "flatbuffers"
brew "git"
brew "glog"
brew "grpc"
brew "llvm@12"
brew "llvm"
brew "llvm@8"
brew "lz4"
brew "minio"
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}")

set(ARROW_LLVM_VERSIONS
"13.0"
"12.0"
"11.1"
"11.0"
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/gandiva/decimal_ir.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,8 +96,8 @@ void DecimalIR::InitializeIntrinsics() {
// CPP: return kScaleMultipliers[scale]
llvm::Value* DecimalIR::GetScaleMultiplier(llvm::Value* scale) {
auto const_array = module()->getGlobalVariable(kScaleMultipliersName);
auto ptr = ir_builder()->CreateGEP(const_array, {types()->i32_constant(0), scale});
return ir_builder()->CreateLoad(ptr);
auto ptr = CreateGEP(ir_builder(), const_array, {types()->i32_constant(0), scale});
return CreateLoad(ir_builder(), ptr);
}

// CPP: x <= y ? y : x
Expand DownExpand Up@@ -248,8 +248,8 @@ llvm::Value* DecimalIR::AddLarge(const ValueFull& x, const ValueFull& y,
ir_builder()->CreateCall(module()->getFunction("add_large_decimal128_decimal128"),
args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
auto sum = ValueSplit(out_high, out_low).AsInt128(this);
ADD_TRACE_128("AddLarge : sum", sum);
return sum;
Expand DownExpand Up@@ -445,8 +445,8 @@ llvm::Value* DecimalIR::CallDecimalFunction(const std::string& function_name,
// Make call to pre-compiled IR function.
ir_builder()->CreateCall(module()->getFunction(function_name), dis_assembled_args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
result = ValueSplit(out_high, out_low).AsInt128(this);
} else {
DCHECK_NE(return_type, types()->void_type());
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/gandiva/engine_llvm_test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,8 +80,8 @@ class TestEngine : public ::testing::Test {
loop_var->addIncoming(loop_update, loop_body);

// get the current value
llvm::Value* offset = builder->CreateGEP(arg_elements, loop_var, "offset");
llvm::Value* current_value = builder->CreateLoad(offset, "value");
llvm::Value* offset = CreateGEP(builder, arg_elements, loop_var, "offset");
llvm::Value* current_value = CreateLoad(builder, offset, "value");

// setup sum PHI
llvm::Value* sum_update = builder->CreateAdd(sum, current_value, "sum+ith");
Expand Down
36 changes: 18 additions & 18 deletions cpp/src/gandiva/llvm_generator.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,8 +143,8 @@ Status LLVMGenerator::Execute(const arrow::RecordBatch& record_batch,
llvm::Value* LLVMGenerator::LoadVectorAtIndex(llvm::Value* arg_addrs, int idx,
const std::string& name) {
auto* idx_val = types()->i32_constant(idx);
auto* offset = ir_builder()->CreateGEP(arg_addrs, idx_val, name + "_mem_addr");
return ir_builder()->CreateLoad(offset, name + "_mem");
auto* offset = CreateGEP(ir_builder(), arg_addrs, idx_val, name + "_mem_addr");
return CreateLoad(ir_builder(), offset, name + "_mem");
}

/// Get reference to validity array at specified index in the args list.
Expand DownExpand Up@@ -314,8 +314,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,

std::vector<llvm::Value*> slice_offsets;
for (int idx = 0; idx < buffer_count; idx++) {
auto offsetAddr = builder->CreateGEP(arg_addr_offsets, types()->i32_constant(idx));
auto offset = builder->CreateLoad(offsetAddr);
auto offsetAddr = CreateGEP(builder, arg_addr_offsets, types()->i32_constant(idx));
auto offset = CreateLoad(builder, offsetAddr);
slice_offsets.push_back(offset);
}

Expand All@@ -328,8 +328,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
llvm::Value* position_var = loop_var;
if (selection_vector_mode != SelectionVector::MODE_NONE) {
position_var = builder->CreateIntCast(
builder->CreateLoad(builder->CreateGEP(arg_selection_vector, loop_var),
"uncasted_position_var"),
CreateLoad(builder, CreateGEP(builder, arg_selection_vector, loop_var),
"uncasted_position_var"),
types()->i64_type(), true, "position_var");
}

Expand All@@ -354,7 +354,7 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
SetPackedBitValue(output_ref, loop_var, output_value->data());
} else if (arrow::is_primitive(output_type_id) ||
output_type_id == arrow::Type::DECIMAL) {
llvm::Value* slot_offset = builder->CreateGEP(output_ref, loop_var);
llvm::Value* slot_offset = CreateGEP(builder, output_ref, loop_var);
builder->CreateStore(output_value->data(), slot_offset);
} else if (arrow::is_binary_like(output_type_id)) {
// Var-len output. Make a function call to populate the data.
Expand DownExpand Up@@ -550,15 +550,15 @@ void LLVMGenerator::Visitor::Visit(const VectorReadFixedLenValueDex& dex) {
break;

case arrow::Type::DECIMAL: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = generator_->BuildDecimalLValue(slot_value, dex.FieldType());
break;
}

default: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = std::make_shared<LValue>(slot_value);
break;
}
Expand All@@ -579,14 +579,14 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
builder->CreateAdd(loop_var_, GetSliceOffset(dex.OffsetsIdx()));

// => offset_start = offsets[loop_var]
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = builder->CreateLoad(slot, "offset_start");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = CreateLoad(builder, slot, "offset_start");

// => offset_end = offsets[loop_var + 1]
llvm::Value* offsets_slot_index_next = builder->CreateAdd(
offsets_slot_index, generator_->types()->i64_constant(1), "loop_var+1");
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = builder->CreateLoad(slot, "offset_end");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = CreateLoad(builder, slot, "offset_end");

// => len_value = offset_end - offset_start
llvm::Value* len_value =
Expand All@@ -595,7 +595,7 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
// get the data from the data array, at offset 'offset_start'.
llvm::Value* data_slot_ref =
GetBufferReference(dex.DataIdx(), kBufferTypeData, dex.Field());
llvm::Value* data_value = builder->CreateGEP(data_slot_ref, offset_start);
llvm::Value* data_value = CreateGEP(builder, data_slot_ref, offset_start);
ADD_VISITOR_TRACE("visit var-len data vector " + dex.FieldName() + " len %T",
len_value);
result_.reset(new LValue(data_value, len_value));
Expand DownExpand Up@@ -806,7 +806,7 @@ void LLVMGenerator::Visitor::Visit(const NullableInternalFuncDex& dex) {
result_ = BuildFunctionCall(native_function, arrow_return_type, &params);

// load the result validity and truncate to i1.
llvm::Value* result_valid_i8 = builder->CreateLoad(result_valid_ptr);
llvm::Value* result_valid_i8 = CreateLoad(builder, result_valid_ptr);
llvm::Value* result_valid = builder->CreateTrunc(result_valid_i8, types->i1_type());

// set validity bit in the local bitmap.
Expand DownExpand Up@@ -1221,7 +1221,7 @@ LValuePtr LLVMGenerator::Visitor::BuildFunctionCall(const NativeFunction* func,
? decimalIR.CallDecimalFunction(func->pc_name(), llvm_return_type, *params)
: generator_->AddFunctionCall(func->pc_name(), llvm_return_type, *params);
auto value_len =
(result_len_ptr == nullptr) ? nullptr : builder->CreateLoad(result_len_ptr);
(result_len_ptr == nullptr) ? nullptr : CreateLoad(builder, result_len_ptr);
return std::make_shared<LValue>(value, value_len);
}
}
Expand Down
13 changes: 13 additions & 0 deletions cpp/src/gandiva/llvm_includes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,3 +41,16 @@
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

// Workaround for deprecated builder methods as of LLVM 13: ARROW-14363
inline llvm::Value* CreateGEP(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
llvm::ArrayRef<llvm::Value*> IdxList,
const llvm::Twine& Name = "") {
return builder->CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(), Ptr,
IdxList, Name);
}

inline llvm::LoadInst* CreateLoad(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
const llvm::Twine& Name = "") {
return builder->CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name);
}
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ARROW-14364: [CI][C++] Support LLVM 13 by kszucs · Pull Request #11448 · apache/arrow · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ci/scripts/msys2_setup.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@ case "${target}" in
packages+=(${MINGW_PACKAGE_PREFIX}-llvm)
packages+=(${MINGW_PACKAGE_PREFIX}-lz4)
packages+=(${MINGW_PACKAGE_PREFIX}-make)
packages+=(${MINGW_PACKAGE_PREFIX}-mlir)
packages+=(${MINGW_PACKAGE_PREFIX}-ninja)
packages+=(${MINGW_PACKAGE_PREFIX}-polly)
packages+=(${MINGW_PACKAGE_PREFIX}-protobuf)
Expand All@@ -60,7 +61,7 @@ case "${target}" in
;;
esac

case "${target}" in
case "${target}" in
cgo)
packages+=(${MINGW_PACKAGE_PREFIX}-arrow)
packages+=(${MINGW_PACKAGE_PREFIX}-gcc)
Expand Down
2 changes: 1 addition & 1 deletion cpp/Brewfile
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ brew "flatbuffers"
brew "git"
brew "glog"
brew "grpc"
brew "llvm@12"
brew "llvm"
brew "llvm@8"
brew "lz4"
brew "minio"
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}")

set(ARROW_LLVM_VERSIONS
"13.0"
"12.0"
"11.1"
"11.0"
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/gandiva/decimal_ir.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,8 +96,8 @@ void DecimalIR::InitializeIntrinsics() {
// CPP: return kScaleMultipliers[scale]
llvm::Value* DecimalIR::GetScaleMultiplier(llvm::Value* scale) {
auto const_array = module()->getGlobalVariable(kScaleMultipliersName);
auto ptr = ir_builder()->CreateGEP(const_array, {types()->i32_constant(0), scale});
return ir_builder()->CreateLoad(ptr);
auto ptr = CreateGEP(ir_builder(), const_array, {types()->i32_constant(0), scale});
return CreateLoad(ir_builder(), ptr);
}

// CPP: x <= y ? y : x
Expand DownExpand Up@@ -248,8 +248,8 @@ llvm::Value* DecimalIR::AddLarge(const ValueFull& x, const ValueFull& y,
ir_builder()->CreateCall(module()->getFunction("add_large_decimal128_decimal128"),
args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
auto sum = ValueSplit(out_high, out_low).AsInt128(this);
ADD_TRACE_128("AddLarge : sum", sum);
return sum;
Expand DownExpand Up@@ -445,8 +445,8 @@ llvm::Value* DecimalIR::CallDecimalFunction(const std::string& function_name,
// Make call to pre-compiled IR function.
ir_builder()->CreateCall(module()->getFunction(function_name), dis_assembled_args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
result = ValueSplit(out_high, out_low).AsInt128(this);
} else {
DCHECK_NE(return_type, types()->void_type());
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/gandiva/engine_llvm_test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,8 +80,8 @@ class TestEngine : public ::testing::Test {
loop_var->addIncoming(loop_update, loop_body);

// get the current value
llvm::Value* offset = builder->CreateGEP(arg_elements, loop_var, "offset");
llvm::Value* current_value = builder->CreateLoad(offset, "value");
llvm::Value* offset = CreateGEP(builder, arg_elements, loop_var, "offset");
llvm::Value* current_value = CreateLoad(builder, offset, "value");

// setup sum PHI
llvm::Value* sum_update = builder->CreateAdd(sum, current_value, "sum+ith");
Expand Down
36 changes: 18 additions & 18 deletions cpp/src/gandiva/llvm_generator.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,8 +143,8 @@ Status LLVMGenerator::Execute(const arrow::RecordBatch& record_batch,
llvm::Value* LLVMGenerator::LoadVectorAtIndex(llvm::Value* arg_addrs, int idx,
const std::string& name) {
auto* idx_val = types()->i32_constant(idx);
auto* offset = ir_builder()->CreateGEP(arg_addrs, idx_val, name + "_mem_addr");
return ir_builder()->CreateLoad(offset, name + "_mem");
auto* offset = CreateGEP(ir_builder(), arg_addrs, idx_val, name + "_mem_addr");
return CreateLoad(ir_builder(), offset, name + "_mem");
}

/// Get reference to validity array at specified index in the args list.
Expand DownExpand Up@@ -314,8 +314,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,

std::vector<llvm::Value*> slice_offsets;
for (int idx = 0; idx < buffer_count; idx++) {
auto offsetAddr = builder->CreateGEP(arg_addr_offsets, types()->i32_constant(idx));
auto offset = builder->CreateLoad(offsetAddr);
auto offsetAddr = CreateGEP(builder, arg_addr_offsets, types()->i32_constant(idx));
auto offset = CreateLoad(builder, offsetAddr);
slice_offsets.push_back(offset);
}

Expand All@@ -328,8 +328,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
llvm::Value* position_var = loop_var;
if (selection_vector_mode != SelectionVector::MODE_NONE) {
position_var = builder->CreateIntCast(
builder->CreateLoad(builder->CreateGEP(arg_selection_vector, loop_var),
"uncasted_position_var"),
CreateLoad(builder, CreateGEP(builder, arg_selection_vector, loop_var),
"uncasted_position_var"),
types()->i64_type(), true, "position_var");
}

Expand All@@ -354,7 +354,7 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
SetPackedBitValue(output_ref, loop_var, output_value->data());
} else if (arrow::is_primitive(output_type_id) ||
output_type_id == arrow::Type::DECIMAL) {
llvm::Value* slot_offset = builder->CreateGEP(output_ref, loop_var);
llvm::Value* slot_offset = CreateGEP(builder, output_ref, loop_var);
builder->CreateStore(output_value->data(), slot_offset);
} else if (arrow::is_binary_like(output_type_id)) {
// Var-len output. Make a function call to populate the data.
Expand DownExpand Up@@ -550,15 +550,15 @@ void LLVMGenerator::Visitor::Visit(const VectorReadFixedLenValueDex& dex) {
break;

case arrow::Type::DECIMAL: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = generator_->BuildDecimalLValue(slot_value, dex.FieldType());
break;
}

default: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = std::make_shared<LValue>(slot_value);
break;
}
Expand All@@ -579,14 +579,14 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
builder->CreateAdd(loop_var_, GetSliceOffset(dex.OffsetsIdx()));

// => offset_start = offsets[loop_var]
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = builder->CreateLoad(slot, "offset_start");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = CreateLoad(builder, slot, "offset_start");

// => offset_end = offsets[loop_var + 1]
llvm::Value* offsets_slot_index_next = builder->CreateAdd(
offsets_slot_index, generator_->types()->i64_constant(1), "loop_var+1");
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = builder->CreateLoad(slot, "offset_end");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = CreateLoad(builder, slot, "offset_end");

// => len_value = offset_end - offset_start
llvm::Value* len_value =
Expand All@@ -595,7 +595,7 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
// get the data from the data array, at offset 'offset_start'.
llvm::Value* data_slot_ref =
GetBufferReference(dex.DataIdx(), kBufferTypeData, dex.Field());
llvm::Value* data_value = builder->CreateGEP(data_slot_ref, offset_start);
llvm::Value* data_value = CreateGEP(builder, data_slot_ref, offset_start);
ADD_VISITOR_TRACE("visit var-len data vector " + dex.FieldName() + " len %T",
len_value);
result_.reset(new LValue(data_value, len_value));
Expand DownExpand Up@@ -806,7 +806,7 @@ void LLVMGenerator::Visitor::Visit(const NullableInternalFuncDex& dex) {
result_ = BuildFunctionCall(native_function, arrow_return_type, &params);

// load the result validity and truncate to i1.
llvm::Value* result_valid_i8 = builder->CreateLoad(result_valid_ptr);
llvm::Value* result_valid_i8 = CreateLoad(builder, result_valid_ptr);
llvm::Value* result_valid = builder->CreateTrunc(result_valid_i8, types->i1_type());

// set validity bit in the local bitmap.
Expand DownExpand Up@@ -1221,7 +1221,7 @@ LValuePtr LLVMGenerator::Visitor::BuildFunctionCall(const NativeFunction* func,
? decimalIR.CallDecimalFunction(func->pc_name(), llvm_return_type, *params)
: generator_->AddFunctionCall(func->pc_name(), llvm_return_type, *params);
auto value_len =
(result_len_ptr == nullptr) ? nullptr : builder->CreateLoad(result_len_ptr);
(result_len_ptr == nullptr) ? nullptr : CreateLoad(builder, result_len_ptr);
return std::make_shared<LValue>(value, value_len);
}
}
Expand Down
13 changes: 13 additions & 0 deletions cpp/src/gandiva/llvm_includes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,3 +41,16 @@
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

// Workaround for deprecated builder methods as of LLVM 13: ARROW-14363
inline llvm::Value* CreateGEP(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
llvm::ArrayRef<llvm::Value*> IdxList,
const llvm::Twine& Name = "") {
return builder->CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(), Ptr,
IdxList, Name);
}

inline llvm::LoadInst* CreateLoad(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
const llvm::Twine& Name = "") {
return builder->CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name);
}
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' ARROW-14364: [CI][C++] Support LLVM 13 by kszucs · Pull Request #11448 · apache/arrow · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ci/scripts/msys2_setup.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@ case "${target}" in
packages+=(${MINGW_PACKAGE_PREFIX}-llvm)
packages+=(${MINGW_PACKAGE_PREFIX}-lz4)
packages+=(${MINGW_PACKAGE_PREFIX}-make)
packages+=(${MINGW_PACKAGE_PREFIX}-mlir)
packages+=(${MINGW_PACKAGE_PREFIX}-ninja)
packages+=(${MINGW_PACKAGE_PREFIX}-polly)
packages+=(${MINGW_PACKAGE_PREFIX}-protobuf)
Expand All@@ -60,7 +61,7 @@ case "${target}" in
;;
esac

case "${target}" in
case "${target}" in
cgo)
packages+=(${MINGW_PACKAGE_PREFIX}-arrow)
packages+=(${MINGW_PACKAGE_PREFIX}-gcc)
Expand Down
2 changes: 1 addition & 1 deletion cpp/Brewfile
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ brew "flatbuffers"
brew "git"
brew "glog"
brew "grpc"
brew "llvm@12"
brew "llvm"
brew "llvm@8"
brew "lz4"
brew "minio"
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}")

set(ARROW_LLVM_VERSIONS
"13.0"
"12.0"
"11.1"
"11.0"
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/gandiva/decimal_ir.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,8 +96,8 @@ void DecimalIR::InitializeIntrinsics() {
// CPP: return kScaleMultipliers[scale]
llvm::Value* DecimalIR::GetScaleMultiplier(llvm::Value* scale) {
auto const_array = module()->getGlobalVariable(kScaleMultipliersName);
auto ptr = ir_builder()->CreateGEP(const_array, {types()->i32_constant(0), scale});
return ir_builder()->CreateLoad(ptr);
auto ptr = CreateGEP(ir_builder(), const_array, {types()->i32_constant(0), scale});
return CreateLoad(ir_builder(), ptr);
}

// CPP: x <= y ? y : x
Expand DownExpand Up@@ -248,8 +248,8 @@ llvm::Value* DecimalIR::AddLarge(const ValueFull& x, const ValueFull& y,
ir_builder()->CreateCall(module()->getFunction("add_large_decimal128_decimal128"),
args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
auto sum = ValueSplit(out_high, out_low).AsInt128(this);
ADD_TRACE_128("AddLarge : sum", sum);
return sum;
Expand DownExpand Up@@ -445,8 +445,8 @@ llvm::Value* DecimalIR::CallDecimalFunction(const std::string& function_name,
// Make call to pre-compiled IR function.
ir_builder()->CreateCall(module()->getFunction(function_name), dis_assembled_args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
result = ValueSplit(out_high, out_low).AsInt128(this);
} else {
DCHECK_NE(return_type, types()->void_type());
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/gandiva/engine_llvm_test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,8 +80,8 @@ class TestEngine : public ::testing::Test {
loop_var->addIncoming(loop_update, loop_body);

// get the current value
llvm::Value* offset = builder->CreateGEP(arg_elements, loop_var, "offset");
llvm::Value* current_value = builder->CreateLoad(offset, "value");
llvm::Value* offset = CreateGEP(builder, arg_elements, loop_var, "offset");
llvm::Value* current_value = CreateLoad(builder, offset, "value");

// setup sum PHI
llvm::Value* sum_update = builder->CreateAdd(sum, current_value, "sum+ith");
Expand Down
36 changes: 18 additions & 18 deletions cpp/src/gandiva/llvm_generator.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,8 +143,8 @@ Status LLVMGenerator::Execute(const arrow::RecordBatch& record_batch,
llvm::Value* LLVMGenerator::LoadVectorAtIndex(llvm::Value* arg_addrs, int idx,
const std::string& name) {
auto* idx_val = types()->i32_constant(idx);
auto* offset = ir_builder()->CreateGEP(arg_addrs, idx_val, name + "_mem_addr");
return ir_builder()->CreateLoad(offset, name + "_mem");
auto* offset = CreateGEP(ir_builder(), arg_addrs, idx_val, name + "_mem_addr");
return CreateLoad(ir_builder(), offset, name + "_mem");
}

/// Get reference to validity array at specified index in the args list.
Expand DownExpand Up@@ -314,8 +314,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,

std::vector<llvm::Value*> slice_offsets;
for (int idx = 0; idx < buffer_count; idx++) {
auto offsetAddr = builder->CreateGEP(arg_addr_offsets, types()->i32_constant(idx));
auto offset = builder->CreateLoad(offsetAddr);
auto offsetAddr = CreateGEP(builder, arg_addr_offsets, types()->i32_constant(idx));
auto offset = CreateLoad(builder, offsetAddr);
slice_offsets.push_back(offset);
}

Expand All@@ -328,8 +328,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
llvm::Value* position_var = loop_var;
if (selection_vector_mode != SelectionVector::MODE_NONE) {
position_var = builder->CreateIntCast(
builder->CreateLoad(builder->CreateGEP(arg_selection_vector, loop_var),
"uncasted_position_var"),
CreateLoad(builder, CreateGEP(builder, arg_selection_vector, loop_var),
"uncasted_position_var"),
types()->i64_type(), true, "position_var");
}

Expand All@@ -354,7 +354,7 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
SetPackedBitValue(output_ref, loop_var, output_value->data());
} else if (arrow::is_primitive(output_type_id) ||
output_type_id == arrow::Type::DECIMAL) {
llvm::Value* slot_offset = builder->CreateGEP(output_ref, loop_var);
llvm::Value* slot_offset = CreateGEP(builder, output_ref, loop_var);
builder->CreateStore(output_value->data(), slot_offset);
} else if (arrow::is_binary_like(output_type_id)) {
// Var-len output. Make a function call to populate the data.
Expand DownExpand Up@@ -550,15 +550,15 @@ void LLVMGenerator::Visitor::Visit(const VectorReadFixedLenValueDex& dex) {
break;

case arrow::Type::DECIMAL: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = generator_->BuildDecimalLValue(slot_value, dex.FieldType());
break;
}

default: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = std::make_shared<LValue>(slot_value);
break;
}
Expand All@@ -579,14 +579,14 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
builder->CreateAdd(loop_var_, GetSliceOffset(dex.OffsetsIdx()));

// => offset_start = offsets[loop_var]
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = builder->CreateLoad(slot, "offset_start");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = CreateLoad(builder, slot, "offset_start");

// => offset_end = offsets[loop_var + 1]
llvm::Value* offsets_slot_index_next = builder->CreateAdd(
offsets_slot_index, generator_->types()->i64_constant(1), "loop_var+1");
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = builder->CreateLoad(slot, "offset_end");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = CreateLoad(builder, slot, "offset_end");

// => len_value = offset_end - offset_start
llvm::Value* len_value =
Expand All@@ -595,7 +595,7 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
// get the data from the data array, at offset 'offset_start'.
llvm::Value* data_slot_ref =
GetBufferReference(dex.DataIdx(), kBufferTypeData, dex.Field());
llvm::Value* data_value = builder->CreateGEP(data_slot_ref, offset_start);
llvm::Value* data_value = CreateGEP(builder, data_slot_ref, offset_start);
ADD_VISITOR_TRACE("visit var-len data vector " + dex.FieldName() + " len %T",
len_value);
result_.reset(new LValue(data_value, len_value));
Expand DownExpand Up@@ -806,7 +806,7 @@ void LLVMGenerator::Visitor::Visit(const NullableInternalFuncDex& dex) {
result_ = BuildFunctionCall(native_function, arrow_return_type, &params);

// load the result validity and truncate to i1.
llvm::Value* result_valid_i8 = builder->CreateLoad(result_valid_ptr);
llvm::Value* result_valid_i8 = CreateLoad(builder, result_valid_ptr);
llvm::Value* result_valid = builder->CreateTrunc(result_valid_i8, types->i1_type());

// set validity bit in the local bitmap.
Expand DownExpand Up@@ -1221,7 +1221,7 @@ LValuePtr LLVMGenerator::Visitor::BuildFunctionCall(const NativeFunction* func,
? decimalIR.CallDecimalFunction(func->pc_name(), llvm_return_type, *params)
: generator_->AddFunctionCall(func->pc_name(), llvm_return_type, *params);
auto value_len =
(result_len_ptr == nullptr) ? nullptr : builder->CreateLoad(result_len_ptr);
(result_len_ptr == nullptr) ? nullptr : CreateLoad(builder, result_len_ptr);
return std::make_shared<LValue>(value, value_len);
}
}
Expand Down
13 changes: 13 additions & 0 deletions cpp/src/gandiva/llvm_includes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,3 +41,16 @@
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

// Workaround for deprecated builder methods as of LLVM 13: ARROW-14363
inline llvm::Value* CreateGEP(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
llvm::ArrayRef<llvm::Value*> IdxList,
const llvm::Twine& Name = "") {
return builder->CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(), Ptr,
IdxList, Name);
}

inline llvm::LoadInst* CreateLoad(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
const llvm::Twine& Name = "") {
return builder->CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name);
}
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ARROW-14364: [CI][C++] Support LLVM 13 by kszucs · Pull Request #11448 · apache/arrow · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ci/scripts/msys2_setup.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@ case "${target}" in
packages+=(${MINGW_PACKAGE_PREFIX}-llvm)
packages+=(${MINGW_PACKAGE_PREFIX}-lz4)
packages+=(${MINGW_PACKAGE_PREFIX}-make)
packages+=(${MINGW_PACKAGE_PREFIX}-mlir)
packages+=(${MINGW_PACKAGE_PREFIX}-ninja)
packages+=(${MINGW_PACKAGE_PREFIX}-polly)
packages+=(${MINGW_PACKAGE_PREFIX}-protobuf)
Expand All@@ -60,7 +61,7 @@ case "${target}" in
;;
esac

case "${target}" in
case "${target}" in
cgo)
packages+=(${MINGW_PACKAGE_PREFIX}-arrow)
packages+=(${MINGW_PACKAGE_PREFIX}-gcc)
Expand Down
2 changes: 1 addition & 1 deletion cpp/Brewfile
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ brew "flatbuffers"
brew "git"
brew "glog"
brew "grpc"
brew "llvm@12"
brew "llvm"
brew "llvm@8"
brew "lz4"
brew "minio"
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}")

set(ARROW_LLVM_VERSIONS
"13.0"
"12.0"
"11.1"
"11.0"
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/gandiva/decimal_ir.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,8 +96,8 @@ void DecimalIR::InitializeIntrinsics() {
// CPP: return kScaleMultipliers[scale]
llvm::Value* DecimalIR::GetScaleMultiplier(llvm::Value* scale) {
auto const_array = module()->getGlobalVariable(kScaleMultipliersName);
auto ptr = ir_builder()->CreateGEP(const_array, {types()->i32_constant(0), scale});
return ir_builder()->CreateLoad(ptr);
auto ptr = CreateGEP(ir_builder(), const_array, {types()->i32_constant(0), scale});
return CreateLoad(ir_builder(), ptr);
}

// CPP: x <= y ? y : x
Expand DownExpand Up@@ -248,8 +248,8 @@ llvm::Value* DecimalIR::AddLarge(const ValueFull& x, const ValueFull& y,
ir_builder()->CreateCall(module()->getFunction("add_large_decimal128_decimal128"),
args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
auto sum = ValueSplit(out_high, out_low).AsInt128(this);
ADD_TRACE_128("AddLarge : sum", sum);
return sum;
Expand DownExpand Up@@ -445,8 +445,8 @@ llvm::Value* DecimalIR::CallDecimalFunction(const std::string& function_name,
// Make call to pre-compiled IR function.
ir_builder()->CreateCall(module()->getFunction(function_name), dis_assembled_args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
result = ValueSplit(out_high, out_low).AsInt128(this);
} else {
DCHECK_NE(return_type, types()->void_type());
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/gandiva/engine_llvm_test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,8 +80,8 @@ class TestEngine : public ::testing::Test {
loop_var->addIncoming(loop_update, loop_body);

// get the current value
llvm::Value* offset = builder->CreateGEP(arg_elements, loop_var, "offset");
llvm::Value* current_value = builder->CreateLoad(offset, "value");
llvm::Value* offset = CreateGEP(builder, arg_elements, loop_var, "offset");
llvm::Value* current_value = CreateLoad(builder, offset, "value");

// setup sum PHI
llvm::Value* sum_update = builder->CreateAdd(sum, current_value, "sum+ith");
Expand Down
36 changes: 18 additions & 18 deletions cpp/src/gandiva/llvm_generator.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,8 +143,8 @@ Status LLVMGenerator::Execute(const arrow::RecordBatch& record_batch,
llvm::Value* LLVMGenerator::LoadVectorAtIndex(llvm::Value* arg_addrs, int idx,
const std::string& name) {
auto* idx_val = types()->i32_constant(idx);
auto* offset = ir_builder()->CreateGEP(arg_addrs, idx_val, name + "_mem_addr");
return ir_builder()->CreateLoad(offset, name + "_mem");
auto* offset = CreateGEP(ir_builder(), arg_addrs, idx_val, name + "_mem_addr");
return CreateLoad(ir_builder(), offset, name + "_mem");
}

/// Get reference to validity array at specified index in the args list.
Expand DownExpand Up@@ -314,8 +314,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,

std::vector<llvm::Value*> slice_offsets;
for (int idx = 0; idx < buffer_count; idx++) {
auto offsetAddr = builder->CreateGEP(arg_addr_offsets, types()->i32_constant(idx));
auto offset = builder->CreateLoad(offsetAddr);
auto offsetAddr = CreateGEP(builder, arg_addr_offsets, types()->i32_constant(idx));
auto offset = CreateLoad(builder, offsetAddr);
slice_offsets.push_back(offset);
}

Expand All@@ -328,8 +328,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
llvm::Value* position_var = loop_var;
if (selection_vector_mode != SelectionVector::MODE_NONE) {
position_var = builder->CreateIntCast(
builder->CreateLoad(builder->CreateGEP(arg_selection_vector, loop_var),
"uncasted_position_var"),
CreateLoad(builder, CreateGEP(builder, arg_selection_vector, loop_var),
"uncasted_position_var"),
types()->i64_type(), true, "position_var");
}

Expand All@@ -354,7 +354,7 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
SetPackedBitValue(output_ref, loop_var, output_value->data());
} else if (arrow::is_primitive(output_type_id) ||
output_type_id == arrow::Type::DECIMAL) {
llvm::Value* slot_offset = builder->CreateGEP(output_ref, loop_var);
llvm::Value* slot_offset = CreateGEP(builder, output_ref, loop_var);
builder->CreateStore(output_value->data(), slot_offset);
} else if (arrow::is_binary_like(output_type_id)) {
// Var-len output. Make a function call to populate the data.
Expand DownExpand Up@@ -550,15 +550,15 @@ void LLVMGenerator::Visitor::Visit(const VectorReadFixedLenValueDex& dex) {
break;

case arrow::Type::DECIMAL: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = generator_->BuildDecimalLValue(slot_value, dex.FieldType());
break;
}

default: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = std::make_shared<LValue>(slot_value);
break;
}
Expand All@@ -579,14 +579,14 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
builder->CreateAdd(loop_var_, GetSliceOffset(dex.OffsetsIdx()));

// => offset_start = offsets[loop_var]
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = builder->CreateLoad(slot, "offset_start");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = CreateLoad(builder, slot, "offset_start");

// => offset_end = offsets[loop_var + 1]
llvm::Value* offsets_slot_index_next = builder->CreateAdd(
offsets_slot_index, generator_->types()->i64_constant(1), "loop_var+1");
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = builder->CreateLoad(slot, "offset_end");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = CreateLoad(builder, slot, "offset_end");

// => len_value = offset_end - offset_start
llvm::Value* len_value =
Expand All@@ -595,7 +595,7 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
// get the data from the data array, at offset 'offset_start'.
llvm::Value* data_slot_ref =
GetBufferReference(dex.DataIdx(), kBufferTypeData, dex.Field());
llvm::Value* data_value = builder->CreateGEP(data_slot_ref, offset_start);
llvm::Value* data_value = CreateGEP(builder, data_slot_ref, offset_start);
ADD_VISITOR_TRACE("visit var-len data vector " + dex.FieldName() + " len %T",
len_value);
result_.reset(new LValue(data_value, len_value));
Expand DownExpand Up@@ -806,7 +806,7 @@ void LLVMGenerator::Visitor::Visit(const NullableInternalFuncDex& dex) {
result_ = BuildFunctionCall(native_function, arrow_return_type, &params);

// load the result validity and truncate to i1.
llvm::Value* result_valid_i8 = builder->CreateLoad(result_valid_ptr);
llvm::Value* result_valid_i8 = CreateLoad(builder, result_valid_ptr);
llvm::Value* result_valid = builder->CreateTrunc(result_valid_i8, types->i1_type());

// set validity bit in the local bitmap.
Expand DownExpand Up@@ -1221,7 +1221,7 @@ LValuePtr LLVMGenerator::Visitor::BuildFunctionCall(const NativeFunction* func,
? decimalIR.CallDecimalFunction(func->pc_name(), llvm_return_type, *params)
: generator_->AddFunctionCall(func->pc_name(), llvm_return_type, *params);
auto value_len =
(result_len_ptr == nullptr) ? nullptr : builder->CreateLoad(result_len_ptr);
(result_len_ptr == nullptr) ? nullptr : CreateLoad(builder, result_len_ptr);
return std::make_shared<LValue>(value, value_len);
}
}
Expand Down
13 changes: 13 additions & 0 deletions cpp/src/gandiva/llvm_includes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,3 +41,16 @@
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

// Workaround for deprecated builder methods as of LLVM 13: ARROW-14363
inline llvm::Value* CreateGEP(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
llvm::ArrayRef<llvm::Value*> IdxList,
const llvm::Twine& Name = "") {
return builder->CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(), Ptr,
IdxList, Name);
}

inline llvm::LoadInst* CreateLoad(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
const llvm::Twine& Name = "") {
return builder->CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name);
}
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' ARROW-14364: [CI][C++] Support LLVM 13 by kszucs · Pull Request #11448 · apache/arrow · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ci/scripts/msys2_setup.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@ case "${target}" in
packages+=(${MINGW_PACKAGE_PREFIX}-llvm)
packages+=(${MINGW_PACKAGE_PREFIX}-lz4)
packages+=(${MINGW_PACKAGE_PREFIX}-make)
packages+=(${MINGW_PACKAGE_PREFIX}-mlir)
packages+=(${MINGW_PACKAGE_PREFIX}-ninja)
packages+=(${MINGW_PACKAGE_PREFIX}-polly)
packages+=(${MINGW_PACKAGE_PREFIX}-protobuf)
Expand All@@ -60,7 +61,7 @@ case "${target}" in
;;
esac

case "${target}" in
case "${target}" in
cgo)
packages+=(${MINGW_PACKAGE_PREFIX}-arrow)
packages+=(${MINGW_PACKAGE_PREFIX}-gcc)
Expand Down
2 changes: 1 addition & 1 deletion cpp/Brewfile
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ brew "flatbuffers"
brew "git"
brew "glog"
brew "grpc"
brew "llvm@12"
brew "llvm"
brew "llvm@8"
brew "lz4"
brew "minio"
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}")

set(ARROW_LLVM_VERSIONS
"13.0"
"12.0"
"11.1"
"11.0"
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/gandiva/decimal_ir.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,8 +96,8 @@ void DecimalIR::InitializeIntrinsics() {
// CPP: return kScaleMultipliers[scale]
llvm::Value* DecimalIR::GetScaleMultiplier(llvm::Value* scale) {
auto const_array = module()->getGlobalVariable(kScaleMultipliersName);
auto ptr = ir_builder()->CreateGEP(const_array, {types()->i32_constant(0), scale});
return ir_builder()->CreateLoad(ptr);
auto ptr = CreateGEP(ir_builder(), const_array, {types()->i32_constant(0), scale});
return CreateLoad(ir_builder(), ptr);
}

// CPP: x <= y ? y : x
Expand DownExpand Up@@ -248,8 +248,8 @@ llvm::Value* DecimalIR::AddLarge(const ValueFull& x, const ValueFull& y,
ir_builder()->CreateCall(module()->getFunction("add_large_decimal128_decimal128"),
args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
auto sum = ValueSplit(out_high, out_low).AsInt128(this);
ADD_TRACE_128("AddLarge : sum", sum);
return sum;
Expand DownExpand Up@@ -445,8 +445,8 @@ llvm::Value* DecimalIR::CallDecimalFunction(const std::string& function_name,
// Make call to pre-compiled IR function.
ir_builder()->CreateCall(module()->getFunction(function_name), dis_assembled_args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
result = ValueSplit(out_high, out_low).AsInt128(this);
} else {
DCHECK_NE(return_type, types()->void_type());
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/gandiva/engine_llvm_test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,8 +80,8 @@ class TestEngine : public ::testing::Test {
loop_var->addIncoming(loop_update, loop_body);

// get the current value
llvm::Value* offset = builder->CreateGEP(arg_elements, loop_var, "offset");
llvm::Value* current_value = builder->CreateLoad(offset, "value");
llvm::Value* offset = CreateGEP(builder, arg_elements, loop_var, "offset");
llvm::Value* current_value = CreateLoad(builder, offset, "value");

// setup sum PHI
llvm::Value* sum_update = builder->CreateAdd(sum, current_value, "sum+ith");
Expand Down
36 changes: 18 additions & 18 deletions cpp/src/gandiva/llvm_generator.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,8 +143,8 @@ Status LLVMGenerator::Execute(const arrow::RecordBatch& record_batch,
llvm::Value* LLVMGenerator::LoadVectorAtIndex(llvm::Value* arg_addrs, int idx,
const std::string& name) {
auto* idx_val = types()->i32_constant(idx);
auto* offset = ir_builder()->CreateGEP(arg_addrs, idx_val, name + "_mem_addr");
return ir_builder()->CreateLoad(offset, name + "_mem");
auto* offset = CreateGEP(ir_builder(), arg_addrs, idx_val, name + "_mem_addr");
return CreateLoad(ir_builder(), offset, name + "_mem");
}

/// Get reference to validity array at specified index in the args list.
Expand DownExpand Up@@ -314,8 +314,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,

std::vector<llvm::Value*> slice_offsets;
for (int idx = 0; idx < buffer_count; idx++) {
auto offsetAddr = builder->CreateGEP(arg_addr_offsets, types()->i32_constant(idx));
auto offset = builder->CreateLoad(offsetAddr);
auto offsetAddr = CreateGEP(builder, arg_addr_offsets, types()->i32_constant(idx));
auto offset = CreateLoad(builder, offsetAddr);
slice_offsets.push_back(offset);
}

Expand All@@ -328,8 +328,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
llvm::Value* position_var = loop_var;
if (selection_vector_mode != SelectionVector::MODE_NONE) {
position_var = builder->CreateIntCast(
builder->CreateLoad(builder->CreateGEP(arg_selection_vector, loop_var),
"uncasted_position_var"),
CreateLoad(builder, CreateGEP(builder, arg_selection_vector, loop_var),
"uncasted_position_var"),
types()->i64_type(), true, "position_var");
}

Expand All@@ -354,7 +354,7 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
SetPackedBitValue(output_ref, loop_var, output_value->data());
} else if (arrow::is_primitive(output_type_id) ||
output_type_id == arrow::Type::DECIMAL) {
llvm::Value* slot_offset = builder->CreateGEP(output_ref, loop_var);
llvm::Value* slot_offset = CreateGEP(builder, output_ref, loop_var);
builder->CreateStore(output_value->data(), slot_offset);
} else if (arrow::is_binary_like(output_type_id)) {
// Var-len output. Make a function call to populate the data.
Expand DownExpand Up@@ -550,15 +550,15 @@ void LLVMGenerator::Visitor::Visit(const VectorReadFixedLenValueDex& dex) {
break;

case arrow::Type::DECIMAL: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = generator_->BuildDecimalLValue(slot_value, dex.FieldType());
break;
}

default: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = std::make_shared<LValue>(slot_value);
break;
}
Expand All@@ -579,14 +579,14 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
builder->CreateAdd(loop_var_, GetSliceOffset(dex.OffsetsIdx()));

// => offset_start = offsets[loop_var]
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = builder->CreateLoad(slot, "offset_start");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = CreateLoad(builder, slot, "offset_start");

// => offset_end = offsets[loop_var + 1]
llvm::Value* offsets_slot_index_next = builder->CreateAdd(
offsets_slot_index, generator_->types()->i64_constant(1), "loop_var+1");
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = builder->CreateLoad(slot, "offset_end");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = CreateLoad(builder, slot, "offset_end");

// => len_value = offset_end - offset_start
llvm::Value* len_value =
Expand All@@ -595,7 +595,7 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
// get the data from the data array, at offset 'offset_start'.
llvm::Value* data_slot_ref =
GetBufferReference(dex.DataIdx(), kBufferTypeData, dex.Field());
llvm::Value* data_value = builder->CreateGEP(data_slot_ref, offset_start);
llvm::Value* data_value = CreateGEP(builder, data_slot_ref, offset_start);
ADD_VISITOR_TRACE("visit var-len data vector " + dex.FieldName() + " len %T",
len_value);
result_.reset(new LValue(data_value, len_value));
Expand DownExpand Up@@ -806,7 +806,7 @@ void LLVMGenerator::Visitor::Visit(const NullableInternalFuncDex& dex) {
result_ = BuildFunctionCall(native_function, arrow_return_type, &params);

// load the result validity and truncate to i1.
llvm::Value* result_valid_i8 = builder->CreateLoad(result_valid_ptr);
llvm::Value* result_valid_i8 = CreateLoad(builder, result_valid_ptr);
llvm::Value* result_valid = builder->CreateTrunc(result_valid_i8, types->i1_type());

// set validity bit in the local bitmap.
Expand DownExpand Up@@ -1221,7 +1221,7 @@ LValuePtr LLVMGenerator::Visitor::BuildFunctionCall(const NativeFunction* func,
? decimalIR.CallDecimalFunction(func->pc_name(), llvm_return_type, *params)
: generator_->AddFunctionCall(func->pc_name(), llvm_return_type, *params);
auto value_len =
(result_len_ptr == nullptr) ? nullptr : builder->CreateLoad(result_len_ptr);
(result_len_ptr == nullptr) ? nullptr : CreateLoad(builder, result_len_ptr);
return std::make_shared<LValue>(value, value_len);
}
}
Expand Down
13 changes: 13 additions & 0 deletions cpp/src/gandiva/llvm_includes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,3 +41,16 @@
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

// Workaround for deprecated builder methods as of LLVM 13: ARROW-14363
inline llvm::Value* CreateGEP(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
llvm::ArrayRef<llvm::Value*> IdxList,
const llvm::Twine& Name = "") {
return builder->CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(), Ptr,
IdxList, Name);
}

inline llvm::LoadInst* CreateLoad(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
const llvm::Twine& Name = "") {
return builder->CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name);
}
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); ARROW-14364: [CI][C++] Support LLVM 13 by kszucs · Pull Request #11448 · apache/arrow · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ci/scripts/msys2_setup.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@ case "${target}" in
packages+=(${MINGW_PACKAGE_PREFIX}-llvm)
packages+=(${MINGW_PACKAGE_PREFIX}-lz4)
packages+=(${MINGW_PACKAGE_PREFIX}-make)
packages+=(${MINGW_PACKAGE_PREFIX}-mlir)
packages+=(${MINGW_PACKAGE_PREFIX}-ninja)
packages+=(${MINGW_PACKAGE_PREFIX}-polly)
packages+=(${MINGW_PACKAGE_PREFIX}-protobuf)
Expand All@@ -60,7 +61,7 @@ case "${target}" in
;;
esac

case "${target}" in
case "${target}" in
cgo)
packages+=(${MINGW_PACKAGE_PREFIX}-arrow)
packages+=(${MINGW_PACKAGE_PREFIX}-gcc)
Expand Down
2 changes: 1 addition & 1 deletion cpp/Brewfile
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ brew "flatbuffers"
brew "git"
brew "glog"
brew "grpc"
brew "llvm@12"
brew "llvm"
brew "llvm@8"
brew "lz4"
brew "minio"
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}")

set(ARROW_LLVM_VERSIONS
"13.0"
"12.0"
"11.1"
"11.0"
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/gandiva/decimal_ir.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,8 +96,8 @@ void DecimalIR::InitializeIntrinsics() {
// CPP: return kScaleMultipliers[scale]
llvm::Value* DecimalIR::GetScaleMultiplier(llvm::Value* scale) {
auto const_array = module()->getGlobalVariable(kScaleMultipliersName);
auto ptr = ir_builder()->CreateGEP(const_array, {types()->i32_constant(0), scale});
return ir_builder()->CreateLoad(ptr);
auto ptr = CreateGEP(ir_builder(), const_array, {types()->i32_constant(0), scale});
return CreateLoad(ir_builder(), ptr);
}

// CPP: x <= y ? y : x
Expand DownExpand Up@@ -248,8 +248,8 @@ llvm::Value* DecimalIR::AddLarge(const ValueFull& x, const ValueFull& y,
ir_builder()->CreateCall(module()->getFunction("add_large_decimal128_decimal128"),
args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
auto sum = ValueSplit(out_high, out_low).AsInt128(this);
ADD_TRACE_128("AddLarge : sum", sum);
return sum;
Expand DownExpand Up@@ -445,8 +445,8 @@ llvm::Value* DecimalIR::CallDecimalFunction(const std::string& function_name,
// Make call to pre-compiled IR function.
ir_builder()->CreateCall(module()->getFunction(function_name), dis_assembled_args);

auto out_high = ir_builder()->CreateLoad(out_high_ptr);
auto out_low = ir_builder()->CreateLoad(out_low_ptr);
auto out_high = CreateLoad(ir_builder(), out_high_ptr);
auto out_low = CreateLoad(ir_builder(), out_low_ptr);
result = ValueSplit(out_high, out_low).AsInt128(this);
} else {
DCHECK_NE(return_type, types()->void_type());
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/gandiva/engine_llvm_test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,8 +80,8 @@ class TestEngine : public ::testing::Test {
loop_var->addIncoming(loop_update, loop_body);

// get the current value
llvm::Value* offset = builder->CreateGEP(arg_elements, loop_var, "offset");
llvm::Value* current_value = builder->CreateLoad(offset, "value");
llvm::Value* offset = CreateGEP(builder, arg_elements, loop_var, "offset");
llvm::Value* current_value = CreateLoad(builder, offset, "value");

// setup sum PHI
llvm::Value* sum_update = builder->CreateAdd(sum, current_value, "sum+ith");
Expand Down
36 changes: 18 additions & 18 deletions cpp/src/gandiva/llvm_generator.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -143,8 +143,8 @@ Status LLVMGenerator::Execute(const arrow::RecordBatch& record_batch,
llvm::Value* LLVMGenerator::LoadVectorAtIndex(llvm::Value* arg_addrs, int idx,
const std::string& name) {
auto* idx_val = types()->i32_constant(idx);
auto* offset = ir_builder()->CreateGEP(arg_addrs, idx_val, name + "_mem_addr");
return ir_builder()->CreateLoad(offset, name + "_mem");
auto* offset = CreateGEP(ir_builder(), arg_addrs, idx_val, name + "_mem_addr");
return CreateLoad(ir_builder(), offset, name + "_mem");
}

/// Get reference to validity array at specified index in the args list.
Expand DownExpand Up@@ -314,8 +314,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,

std::vector<llvm::Value*> slice_offsets;
for (int idx = 0; idx < buffer_count; idx++) {
auto offsetAddr = builder->CreateGEP(arg_addr_offsets, types()->i32_constant(idx));
auto offset = builder->CreateLoad(offsetAddr);
auto offsetAddr = CreateGEP(builder, arg_addr_offsets, types()->i32_constant(idx));
auto offset = CreateLoad(builder, offsetAddr);
slice_offsets.push_back(offset);
}

Expand All@@ -328,8 +328,8 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
llvm::Value* position_var = loop_var;
if (selection_vector_mode != SelectionVector::MODE_NONE) {
position_var = builder->CreateIntCast(
builder->CreateLoad(builder->CreateGEP(arg_selection_vector, loop_var),
"uncasted_position_var"),
CreateLoad(builder, CreateGEP(builder, arg_selection_vector, loop_var),
"uncasted_position_var"),
types()->i64_type(), true, "position_var");
}

Expand All@@ -354,7 +354,7 @@ Status LLVMGenerator::CodeGenExprValue(DexPtr value_expr, int buffer_count,
SetPackedBitValue(output_ref, loop_var, output_value->data());
} else if (arrow::is_primitive(output_type_id) ||
output_type_id == arrow::Type::DECIMAL) {
llvm::Value* slot_offset = builder->CreateGEP(output_ref, loop_var);
llvm::Value* slot_offset = CreateGEP(builder, output_ref, loop_var);
builder->CreateStore(output_value->data(), slot_offset);
} else if (arrow::is_binary_like(output_type_id)) {
// Var-len output. Make a function call to populate the data.
Expand DownExpand Up@@ -550,15 +550,15 @@ void LLVMGenerator::Visitor::Visit(const VectorReadFixedLenValueDex& dex) {
break;

case arrow::Type::DECIMAL: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = generator_->BuildDecimalLValue(slot_value, dex.FieldType());
break;
}

default: {
auto slot_offset = builder->CreateGEP(slot_ref, slot_index);
slot_value = builder->CreateLoad(slot_offset, dex.FieldName());
auto slot_offset = CreateGEP(builder, slot_ref, slot_index);
slot_value = CreateLoad(builder, slot_offset, dex.FieldName());
lvalue = std::make_shared<LValue>(slot_value);
break;
}
Expand All@@ -579,14 +579,14 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
builder->CreateAdd(loop_var_, GetSliceOffset(dex.OffsetsIdx()));

// => offset_start = offsets[loop_var]
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = builder->CreateLoad(slot, "offset_start");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index);
llvm::Value* offset_start = CreateLoad(builder, slot, "offset_start");

// => offset_end = offsets[loop_var + 1]
llvm::Value* offsets_slot_index_next = builder->CreateAdd(
offsets_slot_index, generator_->types()->i64_constant(1), "loop_var+1");
slot = builder->CreateGEP(offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = builder->CreateLoad(slot, "offset_end");
slot = CreateGEP(builder, offsets_slot_ref, offsets_slot_index_next);
llvm::Value* offset_end = CreateLoad(builder, slot, "offset_end");

// => len_value = offset_end - offset_start
llvm::Value* len_value =
Expand All@@ -595,7 +595,7 @@ void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
// get the data from the data array, at offset 'offset_start'.
llvm::Value* data_slot_ref =
GetBufferReference(dex.DataIdx(), kBufferTypeData, dex.Field());
llvm::Value* data_value = builder->CreateGEP(data_slot_ref, offset_start);
llvm::Value* data_value = CreateGEP(builder, data_slot_ref, offset_start);
ADD_VISITOR_TRACE("visit var-len data vector " + dex.FieldName() + " len %T",
len_value);
result_.reset(new LValue(data_value, len_value));
Expand DownExpand Up@@ -806,7 +806,7 @@ void LLVMGenerator::Visitor::Visit(const NullableInternalFuncDex& dex) {
result_ = BuildFunctionCall(native_function, arrow_return_type, &params);

// load the result validity and truncate to i1.
llvm::Value* result_valid_i8 = builder->CreateLoad(result_valid_ptr);
llvm::Value* result_valid_i8 = CreateLoad(builder, result_valid_ptr);
llvm::Value* result_valid = builder->CreateTrunc(result_valid_i8, types->i1_type());

// set validity bit in the local bitmap.
Expand DownExpand Up@@ -1221,7 +1221,7 @@ LValuePtr LLVMGenerator::Visitor::BuildFunctionCall(const NativeFunction* func,
? decimalIR.CallDecimalFunction(func->pc_name(), llvm_return_type, *params)
: generator_->AddFunctionCall(func->pc_name(), llvm_return_type, *params);
auto value_len =
(result_len_ptr == nullptr) ? nullptr : builder->CreateLoad(result_len_ptr);
(result_len_ptr == nullptr) ? nullptr : CreateLoad(builder, result_len_ptr);
return std::make_shared<LValue>(value, value_len);
}
}
Expand Down
13 changes: 13 additions & 0 deletions cpp/src/gandiva/llvm_includes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,3 +41,16 @@
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

// Workaround for deprecated builder methods as of LLVM 13: ARROW-14363
inline llvm::Value* CreateGEP(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
llvm::ArrayRef<llvm::Value*> IdxList,
const llvm::Twine& Name = "") {
return builder->CreateGEP(Ptr->getType()->getScalarType()->getPointerElementType(), Ptr,
IdxList, Name);
}

inline llvm::LoadInst* CreateLoad(llvm::IRBuilder<>* builder, llvm::Value* Ptr,
const llvm::Twine& Name = "") {
return builder->CreateLoad(Ptr->getType()->getPointerElementType(), Ptr, Name);
}