summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora-romanov <[email protected]>2023-05-12 12:26:41 +0300
committera-romanov <[email protected]>2023-05-12 12:26:41 +0300
commit21e94171e7cf3ad5eccf4871e5e3336e307c5179 (patch)
tree353d1b1b5b0037234565b7e01b2ac766ad9cf8c6
parentf39bad6387b7e876b3ecd2c0406a00419d7ab54c (diff)
YQL-15941 Prepare comp nodes for LLVM14.
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_addmember.cpp25
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_append.cpp14
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_apply.cpp12
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_callable.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_chain1_map.cpp24
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_chain_map.cpp24
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_chopper.cpp21
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_collect.cpp29
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_combine.cpp38
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_condense.cpp13
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_condense1.cpp17
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_decimal_div.cpp39
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_decimal_mod.cpp8
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_decimal_mul.cpp64
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_dictitems.cpp13
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_discard.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_element.cpp6
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp5
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_enumerate.cpp6
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_extend.cpp10
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_filter.cpp85
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_flatmap.cpp75
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_flow.cpp16
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_fold.cpp6
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_fold1.cpp10
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_fromstring.cpp58
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_grace_join.cpp41
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_guess.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_heap.cpp40
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_if.cpp15
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_iterator.cpp19
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_join.cpp17
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_join_dict.cpp8
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_lazy_list.cpp8
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp11
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_lookup.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_map.cpp20
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_map_join.cpp142
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_multimap.cpp32
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_prepend.cpp14
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_reduce.cpp2
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_removemember.cpp23
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_reverse.cpp15
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_size.cpp9
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_skip.cpp18
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_squeeze_to_list.cpp12
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_switch.cpp52
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_take.cpp14
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp48
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_toindexdict.cpp15
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_tooptional.cpp18
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_tostring.cpp41
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp10
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp6
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_visitall.cpp14
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_while.cpp31
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_chain_map.cpp7
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_chopper.cpp10
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_combine.cpp64
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_condense.cpp5
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_filter.cpp4
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_wide_top_sort.cpp48
-rw-r--r--ydb/library/yql/minikql/comp_nodes/mkql_withcontext.cpp8
63 files changed, 735 insertions, 734 deletions
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_addmember.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_addmember.cpp
index 34bd1876321..4dd232b742e 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_addmember.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_addmember.cpp
@@ -64,16 +64,17 @@ public:
const auto ptrType = PointerType::getUnqual(valType);
const auto idxType = Type::getInt32Ty(context);
const auto type = ArrayType::get(valType, newSize);
+ const auto itmsType = PointerType::getUnqual(type);
const auto itms = *Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(type), 0U, "itms", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(type), 0U, "itms", block);
+ new AllocaInst(itmsType, 0U, "itms", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(itmsType, 0U, "itms", block);
const auto result = Cache_.GenNewArray(newSize, itms, ctx, block);
- const auto itemsPtr = new LoadInst(itms, "items", block);
+ const auto itemsPtr = new LoadInst(itmsType, itms, "items", block);
const auto array = GetNodeValue(StructObj_, ctx, block);
const auto zero = ConstantInt::get(idxType, 0);
- const auto itemPtr = GetElementPtrInst::CreateInBounds(itemsPtr, {zero, ConstantInt::get(idxType, Index_)}, "item", block);
+ const auto itemPtr = GetElementPtrInst::CreateInBounds(type, itemsPtr, {zero, ConstantInt::get(idxType, Index_)}, "item", block);
GetNodeValue(itemPtr, Member_, ctx, block);
const auto elements = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElements>(ptrType, array, ctx.Codegen, block);
@@ -89,9 +90,9 @@ public:
block = fast;
for (ui32 i = 0; i < Index_; ++i) {
const auto index = ConstantInt::get(idxType, i);
- const auto srcPtr = GetElementPtrInst::CreateInBounds(elements, {index}, "src", block);
- const auto dstPtr = GetElementPtrInst::CreateInBounds(itemsPtr, {zero, index}, "dst", block);
- const auto item = new LoadInst(srcPtr, "item", block);
+ const auto srcPtr = GetElementPtrInst::CreateInBounds(valType, elements, {index}, "src", block);
+ const auto dstPtr = GetElementPtrInst::CreateInBounds(type, itemsPtr, {zero, index}, "dst", block);
+ const auto item = new LoadInst(valType, srcPtr, "item", block);
new StoreInst(item, dstPtr, block);
ValueAddRef(Representations_[i], dstPtr, ctx, block);
}
@@ -99,9 +100,9 @@ public:
for (ui32 i = Index_ + 1U; i < newSize; ++i) {
const auto oldIndex = ConstantInt::get(idxType, --i);
const auto newIndex = ConstantInt::get(idxType, ++i);
- const auto srcPtr = GetElementPtrInst::CreateInBounds(elements, {oldIndex}, "src", block);
- const auto dstPtr = GetElementPtrInst::CreateInBounds(itemsPtr, {zero, newIndex}, "dst", block);
- const auto item = new LoadInst(srcPtr, "item", block);
+ const auto srcPtr = GetElementPtrInst::CreateInBounds(valType, elements, {oldIndex}, "src", block);
+ const auto dstPtr = GetElementPtrInst::CreateInBounds(type, itemsPtr, {zero, newIndex}, "dst", block);
+ const auto item = new LoadInst(valType, srcPtr, "item", block);
new StoreInst(item, dstPtr, block);
ValueAddRef(Representations_[i - 1U], dstPtr, ctx, block);
}
@@ -111,14 +112,14 @@ public:
block = slow;
for (ui32 i = 0; i < Index_; ++i) {
const auto index = ConstantInt::get(idxType, i);
- const auto itemPtr = GetElementPtrInst::CreateInBounds(itemsPtr, {zero, index}, "item", block);
+ const auto itemPtr = GetElementPtrInst::CreateInBounds(type, itemsPtr, {zero, index}, "item", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElement>(itemPtr, array, ctx.Codegen, block, index);
}
for (ui32 i = Index_ + 1U; i < newSize; ++i) {
const auto oldIndex = ConstantInt::get(idxType, --i);
const auto newIndex = ConstantInt::get(idxType, ++i);
- const auto itemPtr = GetElementPtrInst::CreateInBounds(itemsPtr, {zero, newIndex}, "item", block);
+ const auto itemPtr = GetElementPtrInst::CreateInBounds(type, itemsPtr, {zero, newIndex}, "item", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElement>(itemPtr, array, ctx.Codegen, block, oldIndex);
}
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_append.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_append.cpp
index 703b82141bd..a8a73fe20d3 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_append.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_append.cpp
@@ -40,7 +40,7 @@ public:
const auto left = GetNodeValue(Left, ctx, block);
const auto right = GetNodeValue(Right, ctx, block);
- if (IsVoid) {
+ if constexpr (IsVoid) {
const auto work = BasicBlock::Create(context, "work", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
const auto result = PHINode::Create(left->getType(), 2, "result", done);
@@ -56,7 +56,7 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(left->getType(), {factory->getType(), left->getType(), right->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto res = CallInst::Create(funcPtr, {factory, left, right}, "res", block);
+ const auto res = CallInst::Create(funType, funcPtr, {factory, left, right}, "res", block);
result->addIncoming(res, block);
} else {
const auto retPtr = new AllocaInst(left->getType(), 0U, "ret_ptr", block);
@@ -65,8 +65,8 @@ public:
new StoreInst(right, itemPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), retPtr->getType(), itemPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, retPtr, retPtr, itemPtr}, "", block);
- const auto res = new LoadInst(retPtr, "res", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, retPtr, itemPtr}, "", block);
+ const auto res = new LoadInst(left->getType(), retPtr, "res", block);
result->addIncoming(res, block);
}
@@ -78,7 +78,7 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(left->getType(), {factory->getType(), left->getType(), right->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto res = CallInst::Create(funcPtr, {factory, left, right}, "res", block);
+ const auto res = CallInst::Create(funType, funcPtr, {factory, left, right}, "res", block);
return res;
} else {
const auto retPtr = new AllocaInst(left->getType(), 0U, "ret_ptr", block);
@@ -87,8 +87,8 @@ public:
new StoreInst(right, itemPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), retPtr->getType(), itemPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, retPtr, retPtr, itemPtr}, "", block);
- const auto res = new LoadInst(retPtr, "res", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, retPtr, itemPtr}, "", block);
+ const auto res = new LoadInst(left->getType(), retPtr, "res", block);
return res;
}
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_apply.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_apply.cpp
index a613c9dcd92..7e2dabce4c9 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_apply.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_apply.cpp
@@ -46,16 +46,16 @@ public:
const auto idxType = Type::getInt32Ty(context);
const auto valType = Type::getInt128Ty(context);
-
+ const auto arrayType = ArrayType::get(valType, ArgNodes.size());
const auto args = *Stateless || ctx.AlwaysInline ?
- new AllocaInst(ArrayType::get(valType, ArgNodes.size()), 0U, "args", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(ArrayType::get(valType, ArgNodes.size()), 0U, "args", block);
+ new AllocaInst(arrayType, 0U, "args", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(arrayType, 0U, "args", block);
ui32 i = 0;
std::vector<std::pair<Value*, EValueRepresentation>> argsv;
argsv.reserve(ArgNodes.size());
for (const auto node : ArgNodes) {
- const auto argPtr = GetElementPtrInst::CreateInBounds(args, {ConstantInt::get(idxType, 0), ConstantInt::get(idxType, i++)}, "arg_ptr", block);
+ const auto argPtr = GetElementPtrInst::CreateInBounds(arrayType, args, {ConstantInt::get(idxType, 0), ConstantInt::get(idxType, i++)}, "arg_ptr", block);
if (node) {
GetNodeValue(argPtr, node, ctx, block);
argsv.emplace_back(argPtr, node->GetRepresentation());
@@ -68,8 +68,8 @@ public:
codegen->CreateRun(ctx, block, pointer, args);
} else {
const auto callable = GetNodeValue(CallableNode, ctx, block);
- const auto calleePtr = GetElementPtrInst::CreateInBounds(ctx.Ctx, {ConstantInt::get(idxType, 0), ConstantInt::get(idxType, 6)}, "callee_ptr", block);
- const auto previous = new LoadInst(calleePtr, "previous", block);
+ const auto calleePtr = GetElementPtrInst::CreateInBounds(GetCompContextType(context), ctx.Ctx, {ConstantInt::get(idxType, 0), ConstantInt::get(idxType, 6)}, "callee_ptr", block);
+ const auto previous = new LoadInst(calleePtr->getType()->getPointerElementType(), calleePtr, "previous", block);
const auto callee = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), ui64(&Position)), previous->getType(), "callee", block);
new StoreInst(callee, calleePtr, block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::Run>(pointer, callable, ctx.Codegen, block, ctx.GetBuilder(), args);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_callable.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_callable.cpp
index 06010bd4e5a..665e76a40a9 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_callable.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_callable.cpp
@@ -125,7 +125,7 @@ private:
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto arguments = new LoadInst(argsPtr, "arguments", block);
+ const auto arguments = new LoadInst(argsType, argsPtr, "arguments", block);
unsigned i = 0U;
for (const auto node : ArgNodes) {
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_chain1_map.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_chain1_map.cpp
index 8f145ae459b..b86803392b5 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_chain1_map.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_chain1_map.cpp
@@ -76,7 +76,7 @@ public:
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
- const auto state = new LoadInst(statePtr, "load", block);
+ const auto state = new LoadInst(valueType, statePtr, "load", block);
BranchInst::Create(init, next, IsInvalid(state, block), block);
block = init;
@@ -256,7 +256,7 @@ public:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
@@ -414,10 +414,10 @@ public:
const auto size = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListLength>(Type::getInt64Ty(context), list, ctx.Codegen, block);
const auto itemsPtr = *Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", block);
+ new AllocaInst(elementsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(elementsType, 0U, "items_ptr", block);
const auto array = GenNewArray(ctx, size, itemsPtr, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(elementsType, itemsPtr, "items", block);
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
@@ -430,7 +430,7 @@ public:
BranchInst::Create(init, done, good, block);
block = init;
- const auto head = new LoadInst(elements, "head", block);
+ const auto head = new LoadInst(list->getType(), elements, "head", block);
codegenItemArg->CreateSetValue(ctx, block, head);
GetNodeValue(items, ComputationNodes.InitItem, ctx, block);
const auto state = GetNodeValue(ComputationNodes.InitState, ctx, block);
@@ -446,10 +446,10 @@ public:
BranchInst::Create(next, stop, more, block);
block = next;
- const auto src = GetElementPtrInst::CreateInBounds(elements, {index}, "src", block);
- const auto item = new LoadInst(src, "item", block);
+ const auto src = GetElementPtrInst::CreateInBounds(list->getType(), elements, {index}, "src", block);
+ const auto item = new LoadInst(list->getType(), src, "item", block);
codegenItemArg->CreateSetValue(ctx, block, item);
- const auto dst = GetElementPtrInst::CreateInBounds(items, {index}, "dst", block);
+ const auto dst = GetElementPtrInst::CreateInBounds(list->getType(), items, {index}, "dst", block);
GetNodeValue(dst, ComputationNodes.UpdateItem, ctx, block);
const auto newState = GetNodeValue(ComputationNodes.UpdateState, ctx, block);
codegenStateArg->CreateSetValue(ctx, block, newState);
@@ -474,15 +474,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- const auto value = CallInst::Create(doFuncPtr, {self, ctx.Ctx, list}, "value", block);
+ const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
map->addIncoming(value, block);
} else {
const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block);
new StoreInst(list, resultPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
- const auto value = new LoadInst(resultPtr, "value", block);
+ CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
+ const auto value = new LoadInst(list->getType(), resultPtr, "value", block);
map->addIncoming(value, block);
}
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_chain_map.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_chain_map.cpp
index 138944888a1..0cb8b678b12 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_chain_map.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_chain_map.cpp
@@ -57,7 +57,7 @@ public:
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto work = BasicBlock::Create(context, "work", ctx.Func);
- const auto state = new LoadInst(statePtr, "load", block);
+ const auto state = new LoadInst(valueType, statePtr, "load", block);
BranchInst::Create(init, work, IsInvalid(state, block), block);
block = init;
@@ -249,12 +249,12 @@ public:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto work = BasicBlock::Create(context, "work", ctx.Func);
- const auto load = new LoadInst(initArg, "load", block);
+ const auto load = new LoadInst(valueType, initArg, "load", block);
BranchInst::Create(work, init, IsInvalid(load, block), block);
block = init;
@@ -409,10 +409,10 @@ public:
codegenStateArg->CreateSetValue(ctx, block, init);
const auto itemsPtr = *Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", block);
+ new AllocaInst(elementsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(elementsType, 0U, "items_ptr", block);
const auto array = GenNewArray(ctx, size, itemsPtr, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(elementsType, itemsPtr, "items", block);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -429,10 +429,10 @@ public:
BranchInst::Create(next, stop, more, block);
block = next;
- const auto src = GetElementPtrInst::CreateInBounds(elements, {index}, "src", block);
- const auto item = new LoadInst(src, "item", block);
+ const auto src = GetElementPtrInst::CreateInBounds(list->getType(), elements, {index}, "src", block);
+ const auto item = new LoadInst(list->getType(), src, "item", block);
codegenItemArg->CreateSetValue(ctx, block, item);
- const auto dst = GetElementPtrInst::CreateInBounds(items, {index}, "dst", block);
+ const auto dst = GetElementPtrInst::CreateInBounds(list->getType(), items, {index}, "dst", block);
GetNodeValue(dst, ComputationNodes.NewItem, ctx, block);
const auto newState = GetNodeValue(ComputationNodes.NewState, ctx, block);
codegenStateArg->CreateSetValue(ctx, block, newState);
@@ -457,7 +457,7 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType(), init->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- const auto value = CallInst::Create(doFuncPtr, {self, ctx.Ctx, list, init}, "value", block);
+ const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list, init}, "value", block);
map->addIncoming(value, block);
} else {
const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block);
@@ -466,8 +466,8 @@ public:
new StoreInst(init, initPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType(), initPtr->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr, initPtr}, "", block);
- const auto value = new LoadInst(resultPtr, "value", block);
+ CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr, initPtr}, "", block);
+ const auto value = new LoadInst(list->getType(), resultPtr, "value", block);
map->addIncoming(value, block);
}
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_chopper.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_chopper.cpp
index 48c931dac60..8ea5ef7fee1 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_chopper.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_chopper.cpp
@@ -129,8 +129,8 @@ private:
const auto load = BasicBlock::Create(context, "load", ctx.Func);
const auto work = BasicBlock::Create(context, "work", ctx.Func);
- const auto statePtr = GetElementPtrInst::CreateInBounds(ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), static_cast<const IComputationNode*>(this)->GetIndex())}, "state_ptr", block);
- const auto entry = new LoadInst(statePtr, "entry", block);
+ const auto statePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), static_cast<const IComputationNode*>(this)->GetIndex())}, "state_ptr", block);
+ const auto entry = new LoadInst(valueType, statePtr, "entry", block);
const auto next = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, entry, GetConstant(ui64(EState::Next), context), "next", block);
BranchInst::Create(load, work, next, block);
@@ -191,9 +191,10 @@ public:
const auto exit = BasicBlock::Create(context, "exit", ctx.Func);
const auto pass = BasicBlock::Create(context, "pass", ctx.Func);
- const auto result = PHINode::Create(Type::getInt128Ty(context), 5U, "result", exit);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto result = PHINode::Create(valueType, 5U, "result", exit);
- const auto first = new LoadInst(statePtr, "first", block);
+ const auto first = new LoadInst(valueType, statePtr, "first", block);
const auto enter = SwitchInst::Create(first, loop, 2U, block);
enter->addCase(GetInvalid(context), init);
enter->addCase(GetConstant(ui64(EState::Skip), context), pass);
@@ -227,7 +228,7 @@ public:
block = loop;
const auto item = GetNodeValue(Output, ctx, block);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
result->addIncoming(item, block);
BranchInst::Create(part, exit, IsFinish(item, block), block);
@@ -571,9 +572,9 @@ private:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
- const auto first = new LoadInst(stateArg, "first", block);
+ const auto first = new LoadInst(stateType, stateArg, "first", block);
const auto reload = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, first, ConstantInt::get(stateType, ui8(EState::Next)), "reload", block);
BranchInst::Create(load, work, reload, block);
@@ -671,13 +672,13 @@ private:
auto block = main;
const auto input = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(inputArg, "load_input", false, block) : static_cast<Value*>(inputArg);
+ new LoadInst(valueType, inputArg, "load_input", false, block) : static_cast<Value*>(inputArg);
BranchInst::Create(loop, block);
block = loop;
- const auto stream = new LoadInst(streamArg, "stream", block);
+ const auto stream = new LoadInst(valueType, streamArg, "stream", block);
BranchInst::Create(next, work, IsEmpty(stream, block), block);
{
@@ -705,7 +706,7 @@ private:
block = next;
- const auto state = new LoadInst(stateArg, "state", block);
+ const auto state = new LoadInst(stateType, stateArg, "state", block);
const auto choise = SwitchInst::Create(state, skip, 2U, block);
choise->addCase(ConstantInt::get(stateType, ui8(EState::Init)), init);
choise->addCase(ConstantInt::get(stateType, ui8(EState::Chop)), pass);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_collect.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_collect.cpp
index db7d2c22f0b..f2fd19c1d0e 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_collect.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_collect.cpp
@@ -45,14 +45,14 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {factory->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, empty, PointerType::getUnqual(funType), "empty", block);
- const auto first = CallInst::Create(funcPtr, {factory}, "init", block);
+ const auto first = CallInst::Create(funType, funcPtr, {factory}, "init", block);
list->addIncoming(first, block);
} else {
const auto ptr = new AllocaInst(valueType, 0U, "ptr", block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), ptr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, empty, PointerType::getUnqual(funType), "empty", block);
- CallInst::Create(funcPtr, {factory, ptr}, "", block);
- const auto first = new LoadInst(ptr, "init", block);
+ CallInst::Create(funType, funcPtr, {factory, ptr}, "", block);
+ const auto first = new LoadInst(valueType, ptr, "init", block);
list->addIncoming(first, block);
}
@@ -72,7 +72,7 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {factory->getType(), list->getType(), item->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, append, PointerType::getUnqual(funType), "append", block);
- const auto next = CallInst::Create(funcPtr, {factory, list, item}, "next", block);
+ const auto next = CallInst::Create(funType, funcPtr, {factory, list, item}, "next", block);
list->addIncoming(next, block);
} else {
const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block);
@@ -81,8 +81,8 @@ public:
new StoreInst(item, itemPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), retPtr->getType(), itemPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, append, PointerType::getUnqual(funType), "append", block);
- CallInst::Create(funcPtr, {factory, retPtr, retPtr, itemPtr}, "", block);
- const auto next = new LoadInst(retPtr, "next", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, retPtr, itemPtr}, "", block);
+ const auto next = new LoadInst(list->getType(), retPtr, "next", block);
list->addIncoming(next, block);
}
BranchInst::Create(work, block);
@@ -91,8 +91,9 @@ public:
{
block = burn;
const auto thrower = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TCollectFlowWrapper::Throw));
- const auto throwerPtr = CastInst::Create(Instruction::IntToPtr, thrower, PointerType::getUnqual(FunctionType::get(Type::getVoidTy(context), {}, false)), "thrower", block);
- CallInst::Create(throwerPtr, {}, "", block);
+ const auto throwerType = FunctionType::get(Type::getVoidTy(context), {}, false);
+ const auto throwerPtr = CastInst::Create(Instruction::IntToPtr, thrower, PointerType::getUnqual(throwerType), "thrower", block);
+ CallInst::Create(throwerType, throwerPtr, {}, "", block);
new UnreachableInst(context, block);
}
@@ -156,15 +157,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(seq->getType(), {factory->getType(), seq->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto res = CallInst::Create(funcPtr, {factory, seq}, "res", block);
+ const auto res = CallInst::Create(funType, funcPtr, {factory, seq}, "res", block);
result->addIncoming(res, block);
} else {
const auto ptr = new AllocaInst(seq->getType(), 0U, "ptr", block);
new StoreInst(seq, ptr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), ptr->getType(), ptr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, ptr, ptr}, "", block);
- const auto res = new LoadInst(ptr, "res", block);
+ CallInst::Create(funType, funcPtr, {factory, ptr, ptr}, "", block);
+ const auto res = new LoadInst(seq->getType(), ptr, "res", block);
result->addIncoming(res, block);
}
BranchInst::Create(done, block);
@@ -175,15 +176,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(seq->getType(), {factory->getType(), seq->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto res = CallInst::Create(funcPtr, {factory, seq}, "res", block);
+ const auto res = CallInst::Create(funType, funcPtr, {factory, seq}, "res", block);
return res;
} else {
const auto ptr = new AllocaInst(seq->getType(), 0U, "ptr", block);
new StoreInst(seq, ptr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), ptr->getType(), ptr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, ptr, ptr}, "", block);
- const auto res = new LoadInst(ptr, "res", block);
+ CallInst::Create(funType, funcPtr, {factory, ptr, ptr}, "", block);
+ const auto res = new LoadInst(seq->getType(), ptr, "res", block);
return res;
}
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_combine.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_combine.cpp
index eee24cd08d0..7291a7d50d4 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_combine.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_combine.cpp
@@ -283,12 +283,12 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TCombineCoreFlowWrapper::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
BranchInst::Create(more, block);
@@ -301,7 +301,7 @@ public:
const auto isEmptyFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::IsEmpty));
const auto isEmptyFuncType = FunctionType::get(Type::getInt1Ty(context), { statePtrType }, false);
const auto isEmptyFuncPtr = CastInst::Create(Instruction::IntToPtr, isEmptyFunc, PointerType::getUnqual(isEmptyFuncType), "cast", block);
- const auto empty = CallInst::Create(isEmptyFuncPtr, { stateArg }, "empty", block);
+ const auto empty = CallInst::Create(isEmptyFuncType, isEmptyFuncPtr, { stateArg }, "empty", block);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
const auto full = BasicBlock::Create(context, "full", ctx.Func);
@@ -317,9 +317,9 @@ public:
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
- const auto statusPtr = GetElementPtrInst::CreateInBounds(stateArg, { fieldsStruct.This(), fieldsStruct.GetStatus() }, "last", block);
+ const auto statusPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { fieldsStruct.This(), fieldsStruct.GetStatus() }, "last", block);
- const auto last = new LoadInst(statusPtr, "last", block);
+ const auto last = new LoadInst(statusType, statusPtr, "last", block);
result->addIncoming(GetFinish(context), block);
const auto choise = SwitchInst::Create(last, pull, 2U, block);
@@ -367,7 +367,7 @@ public:
const auto atFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::At));
const auto atType = FunctionType::get(ptrValueType, {stateArg->getType(), keyParam->getType()}, false);
const auto atPtr = CastInst::Create(Instruction::IntToPtr, atFunc, PointerType::getUnqual(atType), "function", block);
- const auto place = CallInst::Create(atPtr, {stateArg, keyParam}, "place", block);
+ const auto place = CallInst::Create(atType, atPtr, {stateArg, keyParam}, "place", block);
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -395,7 +395,7 @@ public:
const auto statFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::PushStat));
const auto statType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), stat->getType()}, false);
const auto statPtr = CastInst::Create(Instruction::IntToPtr, statFunc, PointerType::getUnqual(statType), "stat", block);
- CallInst::Create(statPtr, {stateArg, stat}, "", block);
+ CallInst::Create(statType, statPtr, {stateArg, stat}, "", block);
BranchInst::Create(full, block);
}
@@ -408,7 +408,7 @@ public:
const auto extractFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Extract));
const auto extractType = FunctionType::get(Type::getInt1Ty(context), {stateArg->getType(), onePtr->getType(), twoPtr->getType()}, false);
const auto extractPtr = CastInst::Create(Instruction::IntToPtr, extractFunc, PointerType::getUnqual(extractType), "extract", block);
- const auto has = CallInst::Create(extractPtr, {stateArg, onePtr, twoPtr}, "has", block);
+ const auto has = CallInst::Create(extractType, extractPtr, {stateArg, onePtr, twoPtr}, "has", block);
BranchInst::Create(good, more, has, block);
@@ -459,7 +459,7 @@ public:
block = more;
- const auto current = new LoadInst(currentPtr, "current", block);
+ const auto current = new LoadInst(valueType, currentPtr, "current", block);
BranchInst::Create(pull, skip, HasValue(current, block), block);
{
@@ -480,7 +480,7 @@ public:
}
block = good;
- const auto value = new LoadInst(valuePtr, "value", block);
+ const auto value = new LoadInst(valueType, valuePtr, "value", block);
ValueRelease(static_cast<const IComputationNode*>(this)->GetRepresentation(), value, ctx, block);
result->addIncoming(value, block);
BranchInst::Create(over, block);
@@ -768,7 +768,7 @@ private:
const auto next = BasicBlock::Create(context, "next", ctx.Func);
const auto skip = BasicBlock::Create(context, "skip", ctx.Func);
- const auto current = new LoadInst(currArg, "current", block);
+ const auto current = new LoadInst(valueType, currArg, "current", block);
BranchInst::Create(skip, pull, IsEmpty(current, block), block);
block = pull;
@@ -796,7 +796,7 @@ private:
const auto isEmptyFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::IsEmpty));
const auto isEmptyFuncType = FunctionType::get(Type::getInt1Ty(context), { statePtrType }, false);
const auto isEmptyFuncPtr = CastInst::Create(Instruction::IntToPtr, isEmptyFunc, PointerType::getUnqual(isEmptyFuncType), "cast", block);
- const auto empty = CallInst::Create(isEmptyFuncPtr, { stateArg }, "empty", block);
+ const auto empty = CallInst::Create(isEmptyFuncType, isEmptyFuncPtr, { stateArg }, "empty", block);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
const auto full = BasicBlock::Create(context, "full", ctx.Func);
@@ -813,9 +813,9 @@ private:
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
- const auto statusPtr = GetElementPtrInst::CreateInBounds(stateArg, { fieldsStruct.This(), fieldsStruct.GetStatus() }, "last", block);
+ const auto statusPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { fieldsStruct.This(), fieldsStruct.GetStatus() }, "last", block);
- const auto last = new LoadInst(statusPtr, "last", block);
+ const auto last = new LoadInst(statusType, statusPtr, "last", block);
const auto choise = SwitchInst::Create(last, pull, 2U, block);
choise->addCase(ConstantInt::get(statusType, static_cast<ui32>(NUdf::EFetchStatus::Yield)), rest);
@@ -833,7 +833,7 @@ private:
const auto used = GetMemoryUsed(MemLimit, ctx, block);
const auto stream = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
BranchInst::Create(loop, block);
@@ -862,7 +862,7 @@ private:
const auto atFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::At));
const auto atType = FunctionType::get(ptrValueType, {stateArg->getType(), keyParam->getType()}, false);
const auto atPtr = CastInst::Create(Instruction::IntToPtr, atFunc, PointerType::getUnqual(atType), "function", block);
- const auto place = CallInst::Create(atPtr, {stateArg, keyParam}, "place", block);
+ const auto place = CallInst::Create(atType, atPtr, {stateArg, keyParam}, "place", block);
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -890,7 +890,7 @@ private:
const auto statFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::PushStat));
const auto statType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), stat->getType()}, false);
const auto statPtr = CastInst::Create(Instruction::IntToPtr, statFunc, PointerType::getUnqual(statType), "stat", block);
- CallInst::Create(statPtr, {stateArg, stat}, "", block);
+ CallInst::Create(statType, statPtr, {stateArg, stat}, "", block);
BranchInst::Create(full, block);
}
@@ -903,7 +903,7 @@ private:
const auto extractFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Extract));
const auto extractType = FunctionType::get(Type::getInt1Ty(context), {stateArg->getType(), onePtr->getType(), twoPtr->getType()}, false);
const auto extractPtr = CastInst::Create(Instruction::IntToPtr, extractFunc, PointerType::getUnqual(extractType), "extract", block);
- const auto has = CallInst::Create(extractPtr, {stateArg, onePtr, twoPtr}, "has", block);
+ const auto has = CallInst::Create(extractType, extractPtr, {stateArg, onePtr, twoPtr}, "has", block);
BranchInst::Create(good, more, has, block);
@@ -926,7 +926,7 @@ private:
} else {
SafeUnRefUnboxed(valuePtr, ctx, block);
GetNodeValue(valuePtr, Nodes.FinishResultNode, ctx, block);
- const auto value = new LoadInst(valuePtr, "value", block);
+ const auto value = new LoadInst(valueType, valuePtr, "value", block);
const auto exit = BasicBlock::Create(context, "exit", ctx.Func);
BranchInst::Create(more, exit, IsEmpty(value, block), block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_condense.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_condense.cpp
index 825b97ffafb..fb4c28e31e5 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_condense.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_condense.cpp
@@ -92,8 +92,9 @@ public:
const auto stop = BasicBlock::Create(context, "stop", ctx.Func);
const auto exit = BasicBlock::Create(context, "exit", ctx.Func);
- const auto state = new LoadInst(statePtr, "state", block);
- const auto result = PHINode::Create(state->getType(), Switch ? 4U : 3U, "result", exit);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
+ const auto result = PHINode::Create(valueType, Switch ? 4U : 3U, "result", exit);
result->addIncoming(state, block);
const auto select = SwitchInst::Create(state, work, 3U, block);
@@ -112,7 +113,7 @@ public:
const auto cleanup = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&CleanupCurrentContext));
const auto cleanupType = FunctionType::get(Type::getVoidTy(context), {}, false);
const auto cleanupPtr = CastInst::Create(Instruction::IntToPtr, cleanup, PointerType::getUnqual(cleanupType), "cleanup_ctx", block);
- CallInst::Create(cleanupPtr, {}, "", block);
+ CallInst::Create(cleanupType, cleanupPtr, {}, "", block);
}
new StoreInst(GetEmpty(context), statePtr, block);
@@ -371,9 +372,9 @@ private:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(stateType, statePtr, "state", block);
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -400,7 +401,7 @@ private:
const auto cleanup = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&CleanupCurrentContext));
const auto cleanupType = FunctionType::get(Type::getVoidTy(context), {}, false);
const auto cleanupPtr = CastInst::Create(Instruction::IntToPtr, cleanup, PointerType::getUnqual(cleanupType), "cleanup_ctx", block);
- CallInst::Create(cleanupPtr, {}, "", block);
+ CallInst::Create(cleanupType, cleanupPtr, {}, "", block);
}
new StoreInst(ConstantInt::get(state->getType(), static_cast<ui8>(ESqueezeState::Work)), statePtr, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_condense1.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_condense1.cpp
index e9c0ff1b819..dd666a2c4cb 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_condense1.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_condense1.cpp
@@ -93,8 +93,9 @@ public:
const auto stop = BasicBlock::Create(context, "stop", ctx.Func);
const auto exit = BasicBlock::Create(context, "exit", ctx.Func);
- const auto state = new LoadInst(statePtr, "state", block);
- const auto result = PHINode::Create(state->getType(), Switch ? 4U : 3U, "result", exit);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
+ const auto result = PHINode::Create(valueType, Switch ? 4U : 3U, "result", exit);
result->addIncoming(state, block);
const auto way = SwitchInst::Create(state, frst, 2U, block);
@@ -107,7 +108,7 @@ public:
const auto cleanup = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&CleanupCurrentContext));
const auto cleanupType = FunctionType::get(Type::getVoidTy(context), {}, false);
const auto cleanupPtr = CastInst::Create(Instruction::IntToPtr, cleanup, PointerType::getUnqual(cleanupType), "cleanup_ctx", block);
- CallInst::Create(cleanupPtr, {}, "", block);
+ CallInst::Create(cleanupType, cleanupPtr, {}, "", block);
}
new StoreInst(GetEmpty(context), statePtr, block);
@@ -389,13 +390,13 @@ private:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto step = BasicBlock::Create(context, "step", ctx.Func);
const auto none = BasicBlock::Create(context, "none", ctx.Func);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
- const auto state0 = new LoadInst(statePtr, "state0", block);
+ const auto state0 = new LoadInst(stateType, statePtr, "state0", block);
const auto select = SwitchInst::Create(state0, loop, 2U, block);
select->addCase(ConstantInt::get(stateType, static_cast<ui8>(ESqueezeState::Finished)), none);
@@ -410,7 +411,7 @@ private:
const auto cleanup = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&CleanupCurrentContext));
const auto cleanupType = FunctionType::get(Type::getVoidTy(context), {}, false);
const auto cleanupPtr = CastInst::Create(Instruction::IntToPtr, cleanup, PointerType::getUnqual(cleanupType), "cleanup_ctx", block);
- CallInst::Create(cleanupPtr, {}, "", block);
+ CallInst::Create(cleanupType, cleanupPtr, {}, "", block);
}
new StoreInst(ConstantInt::get(state0->getType(), static_cast<ui8>(ESqueezeState::Work)), statePtr, block);
@@ -440,7 +441,7 @@ private:
BranchInst::Create(stop, good, icmp, block);
block = good;
- const auto state1 = new LoadInst(statePtr, "state1", block);
+ const auto state1 = new LoadInst(stateType, statePtr, "state1", block);
const auto one = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, state1, ConstantInt::get(state1->getType(), static_cast<ui8>(ESqueezeState::Idle)), "one", block);
const auto wait = BasicBlock::Create(context, "wait", ctx.Func);
@@ -495,7 +496,7 @@ private:
BranchInst::Create(loop, block);
block = stop;
- const auto state2 = new LoadInst(statePtr, "state2", block);
+ const auto state2 = new LoadInst(stateType, statePtr, "state2", block);
const auto full = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, state2, ConstantInt::get(state2->getType(), static_cast<ui8>(ESqueezeState::Work)), "full", block);
new StoreInst(ConstantInt::get(state2->getType(), static_cast<ui8>(ESqueezeState::Finished)), statePtr, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_div.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_div.cpp
index 8e1617b84d2..d7054da9987 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_div.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_div.cpp
@@ -55,19 +55,15 @@ public:
const auto name = "DecimalMulAndDivNormalMultiplier";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalMulAndDivNormalMultiplier));
- llvm::Value* func;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
- const auto fnType = FunctionType::get(valType, { valType, valType, valType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- } else {
- const auto fnType = FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr, valTypePtr }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- }
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ FunctionType::get(valType, { valType, valType, valType }, false):
+ FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr, valTypePtr }, false);
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
const auto left = GetNodeValue(Left, ctx, block);
const auto right = GetNodeValue(Right, ctx, block);
- if (IsLeftOptional || IsRightOptional) {
+ if constexpr (IsLeftOptional || IsRightOptional) {
const auto test = IsLeftOptional && IsRightOptional ?
BinaryOperator::CreateAnd(left, right, "test", block):
IsLeftOptional ? left : right;
@@ -94,7 +90,7 @@ public:
new StoreInst(NDecimal::GenConstant(Divider, context), arg2Ptr, block);
new StoreInst(GetterForInt128(right, block), arg3Ptr, block);
CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr, arg3Ptr }, "", block);
- muldiv = new LoadInst(retPtr, "res", block);
+ muldiv = new LoadInst(valType, retPtr, "res", block);
}
const auto ok = NDecimal::GenInBounds(muldiv, NDecimal::GenConstant(-Bound, context), NDecimal::GenConstant(+Bound, context), block);
@@ -123,7 +119,7 @@ public:
new StoreInst(NDecimal::GenConstant(Divider, context), arg2Ptr, block);
new StoreInst(GetterForInt128(right, block), arg3Ptr, block);
CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr, arg3Ptr }, "", block);
- muldiv = new LoadInst(retPtr, "res", block);
+ muldiv = new LoadInst(valType, retPtr, "res", block);
}
const auto ok = NDecimal::GenInBounds(muldiv, NDecimal::GenConstant(-Bound, context), NDecimal::GenConstant(+Bound, context), block);
@@ -181,22 +177,17 @@ public:
const auto valType = Type::getInt128Ty(context);
const auto valTypePtr = PointerType::getUnqual(valType);
- const auto fnType = FunctionType::get(valType, {valType, valType}, false);
const auto name = "DecimalDiv";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalDiv));
- llvm::Value* func;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
- const auto fnType = FunctionType::get(valType, { valType, valType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- } else {
- const auto fnType = FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- }
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ FunctionType::get(valType, { valType, valType }, false):
+ FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false);
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
const auto left = GetNodeValue(Left, ctx, block);
const auto right = GetNodeValue(Right, ctx, block);
- if (IsLeftOptional || IsRightOptional) {
+ if constexpr (IsLeftOptional || IsRightOptional) {
const auto test = IsLeftOptional && IsRightOptional ?
BinaryOperator::CreateAnd(left, right, "test", block):
IsLeftOptional ? left : right;
@@ -225,7 +216,7 @@ public:
new StoreInst(GetterForInt128(left, block), arg1Ptr, block);
new StoreInst(cast, arg2Ptr, block);
CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block);
- div = new LoadInst(retPtr, "res", block);
+ div = new LoadInst(valType, retPtr, "res", block);
}
result->addIncoming(SetterForInt128(div, block), block);
@@ -247,7 +238,7 @@ public:
new StoreInst(GetterForInt128(left, block), arg1Ptr, block);
new StoreInst(cast, arg2Ptr, block);
CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block);
- div = new LoadInst(retPtr, "res", block);
+ div = new LoadInst(valType, retPtr, "res", block);
}
return SetterForInt128(div, block);
}
@@ -276,7 +267,7 @@ IComputationNode* WrapDecimalDiv(TCallable& callable, const TComputationNodeFact
auto left = LocateNode(ctx.NodeLocator, callable, 0);
auto right = LocateNode(ctx.NodeLocator, callable, 1);
- switch(rightType->GetSchemeType()) {
+ switch (rightType->GetSchemeType()) {
case NUdf::TDataType<NUdf::TDecimal>::Id:
MKQL_ENSURE(static_cast<TDataDecimalType*>(rightType)->IsSameType(*leftType), "Operands type mismatch");
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mod.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mod.cpp
index 280eeb463af..3dd8f06f8a3 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mod.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mod.cpp
@@ -47,7 +47,7 @@ public:
const auto zero = ConstantInt::get(valType, 0ULL);
const auto result = PHINode::Create(valType, IsLeftOptional || IsRightOptional ? 3 : 2, "result", done);
- if (IsLeftOptional || IsRightOptional) {
+ if constexpr (IsLeftOptional || IsRightOptional) {
const auto test = IsLeftOptional && IsRightOptional ?
BinaryOperator::CreateAnd(left, right, "test", block):
IsLeftOptional ? left : right;
@@ -133,7 +133,7 @@ public:
const auto r = NYql::NDecimal::TInt128(right.Get<TRight>());
- if (std::is_signed<TRight>::value) {
+ if constexpr (std::is_signed<TRight>::value) {
if (r >= +Bound || r <= -Bound)
return left.Release();
} else {
@@ -160,7 +160,7 @@ public:
const auto zero = ConstantInt::get(valType, 0ULL);
const auto result = PHINode::Create(valType, IsLeftOptional || IsRightOptional ? 3 : 2, "result", done);
- if (IsLeftOptional || IsRightOptional) {
+ if constexpr (IsLeftOptional || IsRightOptional) {
const auto test = IsLeftOptional && IsRightOptional ?
BinaryOperator::CreateAnd(left, right, "test", block):
IsLeftOptional ? left : right;
@@ -253,7 +253,7 @@ IComputationNode* WrapDecimalMod(TCallable& callable, const TComputationNodeFact
auto left = LocateNode(ctx.NodeLocator, callable, 0);
auto right = LocateNode(ctx.NodeLocator, callable, 1);
- switch(rightType->GetSchemeType()) {
+ switch (rightType->GetSchemeType()) {
case NUdf::TDataType<NUdf::TDecimal>::Id:
MKQL_ENSURE(static_cast<TDataDecimalType*>(rightType)->IsSameType(*leftType), "Operands type mismatch");
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mul.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mul.cpp
index 746fef81730..b6d5053c6f8 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mul.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_decimal_mul.cpp
@@ -57,34 +57,23 @@ public:
const auto valType = Type::getInt128Ty(context);
const auto valTypePtr = PointerType::getUnqual(valType);
- llvm::Value* func;
const bool useMulAddDiv = Divider > 1;
- if (useMulAddDiv) {
- const auto name = "DecimalMulAndDivNormalDivider";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalMulAndDivNormalDivider));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
- const auto fnType = FunctionType::get(valType, { valType, valType, valType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- } else {
- const auto fnType = FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr, valTypePtr }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- }
- } else {
- const auto name = "DecimalMul";
- ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalMul));
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
- const auto fnType = FunctionType::get(valType, { valType, valType}, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- } else {
- const auto fnType = FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- }
- }
+ const auto name = useMulAddDiv ? "DecimalMul" : "DecimalMulAndDivNormalDivider";
+ const auto fnType = useMulAddDiv ?
+ NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ FunctionType::get(valType, { valType, valType, valType }, false):
+ FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr, valTypePtr }, false):
+ NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ FunctionType::get(valType, { valType, valType}, false):
+ FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false);
+
+ ctx.Codegen->AddGlobalMapping(name, useMulAddDiv ? reinterpret_cast<const void*>(&DecimalMulAndDivNormalDivider) : reinterpret_cast<const void*>(&DecimalMul));
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
const auto left = GetNodeValue(Left, ctx, block);
const auto right = GetNodeValue(Right, ctx, block);
- if (IsLeftOptional || IsRightOptional) {
+ if constexpr (IsLeftOptional || IsRightOptional) {
const auto test = IsLeftOptional && IsRightOptional ?
BinaryOperator::CreateAnd(left, right, "test", block):
IsLeftOptional ? left : right;
@@ -112,7 +101,7 @@ public:
new StoreInst(GetterForInt128(right, block), arg2Ptr, block);
new StoreInst(NDecimal::GenConstant(Divider, context), arg3Ptr, block);
CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr, arg3Ptr }, "", block);
- muldiv = new LoadInst(retPtr, "res", block);
+ muldiv = new LoadInst(valType, retPtr, "res", block);
}
} else {
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
@@ -124,7 +113,7 @@ public:
new StoreInst(GetterForInt128(left, block), arg1Ptr, block);
new StoreInst(GetterForInt128(right, block), arg2Ptr, block);
CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block);
- muldiv = new LoadInst(retPtr, "res", block);
+ muldiv = new LoadInst(valType, retPtr, "res", block);
}
}
@@ -155,7 +144,7 @@ public:
new StoreInst(GetterForInt128(right, block), arg2Ptr, block);
new StoreInst(NDecimal::GenConstant(Divider, context), arg3Ptr, block);
CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr, arg3Ptr }, "", block);
- muldiv = new LoadInst(retPtr, "res", block);
+ muldiv = new LoadInst(valType, retPtr, "res", block);
}
} else {
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
@@ -167,7 +156,7 @@ public:
new StoreInst(GetterForInt128(left, block), arg1Ptr, block);
new StoreInst(GetterForInt128(right, block), arg2Ptr, block);
CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block);
- muldiv = new LoadInst(retPtr, "res", block);
+ muldiv = new LoadInst(valType, retPtr, "res", block);
}
}
@@ -232,22 +221,17 @@ public:
const auto valType = Type::getInt128Ty(context);
const auto valTypePtr = PointerType::getUnqual(valType);
- const auto fnType = FunctionType::get(valType, {valType, valType}, false);
const auto name = "DecimalMul";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalMul));
- llvm::Value* func;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
- const auto fnType = FunctionType::get(valType, { valType, valType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- } else {
- const auto fnType = FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- }
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ FunctionType::get(valType, { valType, valType }, false):
+ FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, valTypePtr }, false);
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
const auto left = GetNodeValue(Left, ctx, block);
const auto right = GetNodeValue(Right, ctx, block);
- if (IsLeftOptional || IsRightOptional) {
+ if constexpr (IsLeftOptional || IsRightOptional) {
const auto test = IsLeftOptional && IsRightOptional ?
BinaryOperator::CreateAnd(left, right, "test", block):
IsLeftOptional ? left : right;
@@ -275,7 +259,7 @@ public:
new StoreInst(GetterForInt128(left, block), arg1Ptr, block);
new StoreInst(cast, arg2Ptr, block);
CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block);
- mul = new LoadInst(retPtr, "res", block);
+ mul = new LoadInst(valType, retPtr, "res", block);
}
const auto ok = NDecimal::GenInBounds(mul, NDecimal::GenConstant(-Bound, context), NDecimal::GenConstant(+Bound, context), block);
@@ -305,7 +289,7 @@ public:
new StoreInst(GetterForInt128(left, block), arg1Ptr, block);
new StoreInst(cast, arg2Ptr, block);
CallInst::Create(func, { retPtr, arg1Ptr, arg2Ptr }, "", block);
- mul = new LoadInst(retPtr, "res", block);
+ mul = new LoadInst(valType, retPtr, "res", block);
}
const auto ok = NDecimal::GenInBounds(mul, NDecimal::GenConstant(-Bound, context), NDecimal::GenConstant(+Bound, context), block);
@@ -345,7 +329,7 @@ IComputationNode* WrapDecimalMul(TCallable& callable, const TComputationNodeFact
auto left = LocateNode(ctx.NodeLocator, callable, 0);
auto right = LocateNode(ctx.NodeLocator, callable, 1);
- switch(rightType->GetSchemeType()) {
+ switch (rightType->GetSchemeType()) {
case NUdf::TDataType<NUdf::TDecimal>::Id:
MKQL_ENSURE(static_cast<TDataDecimalType*>(rightType)->IsSameType(*leftType), "Operands type mismatch");
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_dictitems.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_dictitems.cpp
index a20f016b579..ba0e8486cff 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_dictitems.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_dictitems.cpp
@@ -176,7 +176,7 @@ private:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
@@ -184,8 +184,8 @@ private:
const auto pairPtr = new AllocaInst(pairType, 0U, "pair_ptr", block);
new StoreInst(ConstantAggregateZero::get(pairType), pairPtr, block);
- const auto keyPtr = GetElementPtrInst::CreateInBounds(pairPtr, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 0)}, "key_ptr", block);
- const auto payPtr = GetElementPtrInst::CreateInBounds(pairPtr, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 1)}, "pay_ptr", block);
+ const auto keyPtr = GetElementPtrInst::CreateInBounds(pairType, pairPtr, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 0)}, "key_ptr", block);
+ const auto payPtr = GetElementPtrInst::CreateInBounds(pairType, pairPtr, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 1)}, "pay_ptr", block);
const auto status = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::NextPair>(statusType, container, codegen, block, keyPtr, payPtr);
@@ -194,11 +194,12 @@ private:
SafeUnRefUnboxed(valuePtr, ctx, block);
- const auto itemsPtr = new AllocaInst(PointerType::getUnqual(pairType), 0U, "items_ptr", block);
+ const auto itemsType = PointerType::getUnqual(pairType);
+ const auto itemsPtr = new AllocaInst(itemsType, 0U, "items_ptr", block);
const auto output = ResPair.GenNewArray(2U, itemsPtr, ctx, block);
AddRefBoxed(output, ctx, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
- const auto pair = new LoadInst(pairPtr, "pair", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
+ const auto pair = new LoadInst(pairType, pairPtr, "pair", block);
new StoreInst(pair, items, block);
new StoreInst(output, valuePtr, block);
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_discard.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_discard.cpp
index 78c20eb3cf8..a94bbcc8ec8 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_discard.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_discard.cpp
@@ -185,7 +185,7 @@ private:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_element.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_element.cpp
index c91edcb8be2..0a92ecdf69a 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_element.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_element.cpp
@@ -134,7 +134,7 @@ public:
const auto slow = BasicBlock::Create(context, "slow", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
- if (IsOptional) {
+ if constexpr (IsOptional) {
const auto zero = ConstantInt::get(cache->getType(), 0ULL);
const auto check = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, cache, zero, "check", block);
@@ -158,8 +158,8 @@ public:
block = fast;
const auto index = ConstantInt::get(Type::getInt32Ty(context), this->Index);
- const auto ptr = GetElementPtrInst::CreateInBounds(elements, {index}, "ptr", block);
- const auto item = new LoadInst(ptr, "item", block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(cache->getType(), elements, {index}, "ptr", block);
+ const auto item = new LoadInst(cache->getType(), ptr, "item", block);
ValueAddRef(this->GetRepresentation(), item, ctx, block);
new StoreInst(item, pointer, block);
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp
index 85c8371ec6a..23976b22902 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp
@@ -48,8 +48,9 @@ public:
block = kill;
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TEnsureWrapper::Throw));
const auto doFuncArg = ConstantInt::get(Type::getInt64Ty(context), (ui64)this);
- const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(FunctionType::get(Type::getVoidTy(context), { Type::getInt64Ty(context), ctx.Ctx->getType() }, false)), "thrower", block);
- CallInst::Create(doFuncPtr, { doFuncArg, ctx.Ctx }, "", block)->setTailCall();
+ const auto doFuncType = FunctionType::get(Type::getVoidTy(context), { Type::getInt64Ty(context), ctx.Ctx->getType() }, false);
+ const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(doFuncType), "thrower", block);
+ CallInst::Create(doFuncType, doFuncPtr, { doFuncArg, ctx.Ctx }, "", block)->setTailCall();
new UnreachableInst(context, block);
block = good;
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_enumerate.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_enumerate.cpp
index 727aae0d0b6..db9efbe438b 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_enumerate.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_enumerate.cpp
@@ -135,15 +135,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto signature = FunctionType::get(list->getType(), {self->getType(), ctx.Ctx->getType(), list->getType(), start->getType(), step->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
- const auto output = CallInst::Create(creator, {self, ctx.Ctx, list, start, step}, "output", block);
+ const auto output = CallInst::Create(signature, creator, {self, ctx.Ctx, list, start, step}, "output", block);
return output;
} else {
const auto place = new AllocaInst(list->getType(), 0U, "place", block);
new StoreInst(list, place, block);
const auto signature = FunctionType::get(Type::getVoidTy(context), {self->getType(), place->getType(), ctx.Ctx->getType(), place->getType(), start->getType(), step->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
- CallInst::Create(creator, {self, place, ctx.Ctx, place, start, step}, "", block);
- const auto output = new LoadInst(place, "output", block);
+ CallInst::Create(signature, creator, {self, place, ctx.Ctx, place, start, step}, "", block);
+ const auto output = new LoadInst(list->getType(), place, "output", block);
return output;
}
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_extend.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_extend.cpp
index 36fd03b0a4c..e8c71d99dd5 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_extend.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_extend.cpp
@@ -37,7 +37,7 @@ public:
const auto valueType = Type::getInt128Ty(context);
const auto indexType = Type::getInt64Ty(context);
- const auto load = new LoadInst(statePtr, "load", block);
+ const auto load = new LoadInst(valueType, statePtr, "load", block);
const auto state = SelectInst::Create(IsInvalid(load, block), ConstantInt::get(indexType, 0ULL), GetterFor<ui64>(load, context, block), "index", block);
const auto main = BasicBlock::Create(context, "main", ctx.Func);
@@ -118,7 +118,7 @@ public:
new AllocaInst(arrayType, 0U, "array", block);
for (size_t i = 0U; i < Lists.size(); ++i) {
- const auto ptr = GetElementPtrInst::CreateInBounds(array, {ConstantInt::get(sizeType, 0), ConstantInt::get(sizeType, i)}, (TString("ptr_") += ToString(i)).c_str(), block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(arrayType, array, {ConstantInt::get(sizeType, 0), ConstantInt::get(sizeType, i)}, (TString("ptr_") += ToString(i)).c_str(), block);
GetNodeValue(ptr, Lists[i], ctx, block);
}
@@ -128,14 +128,14 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {factory->getType(), array->getType(), size->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto res = CallInst::Create(funcPtr, {factory, array, size}, "res", block);
+ const auto res = CallInst::Create(funType, funcPtr, {factory, array, size}, "res", block);
return res;
} else {
const auto retPtr = new AllocaInst(valueType, 0U, "ret_ptr", block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), array->getType(), size->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, retPtr, array, size}, "", block);
- const auto res = new LoadInst(retPtr, "res", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, array, size}, "", block);
+ const auto res = new LoadInst(valueType, retPtr, "res", block);
return res;
}
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_filter.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_filter.cpp
index 7de0ebd8305..b852475ec6b 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_filter.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_filter.cpp
@@ -104,7 +104,8 @@ public:
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto exit = BasicBlock::Create(context, "exit", ctx.Func);
- const auto result = PHINode::Create(Type::getInt128Ty(context), 3U, "result", exit);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto result = PHINode::Create(valueType, 3U, "result", exit);
BranchInst::Create(init, test, IsInvalid(statePtr, block), block);
@@ -115,7 +116,7 @@ public:
block = test;
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto done = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, state, GetFalse(context), "done", block);
result->addIncoming(GetFinish(context), block);
BranchInst::Create(exit, loop, done, block);
@@ -297,7 +298,7 @@ protected:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
@@ -318,7 +319,7 @@ protected:
BranchInst::Create(good, done, icmp, block);
block = good;
- const auto item = new LoadInst(itemPtr, "item", block);
+ const auto item = new LoadInst(valueType, itemPtr, "item", block);
const auto predicate = GetNodeValue(Predicate, ctx, block);
const auto boolPred = CastInst::Create(Instruction::Trunc, predicate, Type::getInt1Ty(context), "bool", block);
@@ -510,7 +511,7 @@ protected:
const auto pass = BasicBlock::Create(context, "pass", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
- const auto limit = new LoadInst(limitArg, "limit", false, block);
+ const auto limit = new LoadInst(limitType, limitArg, "limit", false, block);
const auto zero = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, limit, ConstantInt::get(limit->getType(), 0), "zero", block);
BranchInst::Create(nope, init, zero, block);
@@ -519,7 +520,7 @@ protected:
block = init;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
BranchInst::Create(loop, block);
block = loop;
@@ -535,7 +536,7 @@ protected:
BranchInst::Create(good, done, icmp, block);
block = good;
- const auto item = new LoadInst(itemPtr, "item", block);
+ const auto item = new LoadInst(valueType, itemPtr, "item", block);
const auto predicate = GetNodeValue(Predicate, ctx, block);
const auto boolPred = CastInst::Create(Instruction::Trunc, predicate, Type::getInt1Ty(context), "bool", block);
@@ -768,7 +769,7 @@ public:
const auto array = *Stateless || ctx.AlwaysInline ?
new AllocaInst(arrayType, 0U, "array", &ctx.Func->getEntryBlock().back()):
new AllocaInst(arrayType, 0U, "array", block);
- const auto ptr = GetElementPtrInst::CreateInBounds(array, {zeroSize, zeroSize}, "ptr", block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(arrayType, array, {zeroSize, zeroSize}, "ptr", block);
bits->addIncoming(ptr, block);
BranchInst::Create(main, block);
@@ -780,7 +781,7 @@ public:
const auto fnType = FunctionType::get(bits->getType(), {shr->getType()}, false);
const auto name = "MyAlloc";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyAlloc));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
const auto ptr = CallInst::Create(func, {shr}, "ptr", block);
bits->addIncoming(ptr, block);
BranchInst::Create(main, block);
@@ -816,8 +817,8 @@ public:
block = test;
- const auto ptr = GetElementPtrInst::CreateInBounds(elements, {index}, "ptr", block);
- const auto item = new LoadInst(ptr, "item", block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(list->getType(), elements, {index}, "ptr", block);
+ const auto item = new LoadInst(list->getType(), ptr, "item", block);
codegenItem->CreateSetValue(ctx, block, item);
const auto predicate = GetNodeValue(Predicate, ctx, block);
const auto boolPred = CastInst::Create(Instruction::Trunc, predicate, Type::getInt1Ty(context), "bool", block);
@@ -841,7 +842,7 @@ public:
block = save;
const auto div = BinaryOperator::CreateLShr(index, ConstantInt::get(index->getType(), 6), "div", block);
- const auto savePtr = GetElementPtrInst::CreateInBounds(bits, {div}, "save_ptr", block);
+ const auto savePtr = GetElementPtrInst::CreateInBounds(maskType, bits, {div}, "save_ptr", block);
new StoreInst(newset, savePtr, block);
index->addIncoming(plus, block);
@@ -862,11 +863,12 @@ public:
CleanupBoxed(list, ctx, block);
}
+ const auto itemsType = PointerType::getUnqual(list->getType());
const auto itemsPtr = *Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", block);
+ new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(itemsType, 0U, "items_ptr", block);
const auto array = GenNewArray(ctx, count, itemsPtr, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
const auto move = BasicBlock::Create(context, "move", ctx.Func);
const auto work = BasicBlock::Create(context, "work", ctx.Func);
@@ -885,8 +887,8 @@ public:
BranchInst::Create(move, last, many, block);
block = move;
- const auto mptr = GetElementPtrInst::CreateInBounds(bits, {idx}, "mptr", block);
- const auto load = new LoadInst(mptr, "load", block);
+ const auto mptr = GetElementPtrInst::CreateInBounds(maskType, bits, {idx}, "mptr", block);
+ const auto load = new LoadInst(maskType, mptr, "load", block);
const auto six = BinaryOperator::CreateAdd(one, ConstantInt::get(one->getType(), 64), "six", block);
const auto inc = BinaryOperator::CreateAdd(idx, plusSize, "inc", block);
@@ -923,10 +925,10 @@ public:
block = copy;
- const auto src = GetElementPtrInst::CreateInBounds(elements, {one0}, "src", block);
- const auto dst = GetElementPtrInst::CreateInBounds(items, {two0}, "dst", block);
+ const auto src = GetElementPtrInst::CreateInBounds(list->getType(), elements, {one0}, "src", block);
+ const auto dst = GetElementPtrInst::CreateInBounds(list->getType(), items, {two0}, "dst", block);
- const auto item = new LoadInst(src, "item", block);
+ const auto item = new LoadInst(list->getType(), src, "item", block);
ValueAddRef(Item->GetRepresentation(), item, ctx, block);
new StoreInst(item, dst, block);
@@ -951,7 +953,7 @@ public:
const auto fnType = FunctionType::get(Type::getVoidTy(context), {bits->getType(), shr->getType()}, false);
const auto name = "MyFree";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyFree));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
CallInst::Create(func, {bits, shr}, "", block);
out->addIncoming(output, block);
@@ -968,15 +970,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- const auto value = CallInst::Create(doFuncPtr, {self, ctx.Ctx, list}, "value", block);
+ const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
out->addIncoming(value, block);
} else {
const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block);
new StoreInst(list, resultPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
- const auto value = new LoadInst(resultPtr, "value", block);
+ CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
+ const auto value = new LoadInst(list->getType(), resultPtr, "value", block);
out->addIncoming(value, block);
}
BranchInst::Create(done, block);
@@ -1133,7 +1135,7 @@ public:
const auto array = *Stateless || ctx.AlwaysInline ?
new AllocaInst(arrayType, 0U, "array", &ctx.Func->getEntryBlock().back()):
new AllocaInst(arrayType, 0U, "array", block);
- const auto ptr = GetElementPtrInst::CreateInBounds(array, {zeroSize, zeroSize}, "ptr", block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(arrayType, array, {zeroSize, zeroSize}, "ptr", block);
bits->addIncoming(ptr, block);
BranchInst::Create(main, block);
@@ -1145,7 +1147,7 @@ public:
const auto fnType = FunctionType::get(bits->getType(), {shr->getType()}, false);
const auto name = "MyAlloc";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyAlloc));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
const auto ptr = CallInst::Create(func, {shr}, "ptr", block);
bits->addIncoming(ptr, block);
BranchInst::Create(main, block);
@@ -1183,8 +1185,8 @@ public:
block = test;
- const auto ptr = GetElementPtrInst::CreateInBounds(elements, {index}, "ptr", block);
- const auto item = new LoadInst(ptr, "item", block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(list->getType(), elements, {index}, "ptr", block);
+ const auto item = new LoadInst(list->getType(), ptr, "item", block);
codegenItem->CreateSetValue(ctx, block, item);
const auto predicate = GetNodeValue(Predicate, ctx, block);
const auto boolPred = CastInst::Create(Instruction::Trunc, predicate, Type::getInt1Ty(context), "bool", block);
@@ -1210,7 +1212,7 @@ public:
block = save;
const auto div = BinaryOperator::CreateLShr(index, ConstantInt::get(index->getType(), 6), "div", block);
- const auto savePtr = GetElementPtrInst::CreateInBounds(bits, {div}, "save_ptr", block);
+ const auto savePtr = GetElementPtrInst::CreateInBounds(maskType, bits, {div}, "save_ptr", block);
new StoreInst(newset, savePtr, block);
index->addIncoming(plus, block);
@@ -1231,11 +1233,12 @@ public:
CleanupBoxed(list, ctx, block);
}
+ const auto itemsType = PointerType::getUnqual(list->getType());
const auto itemsPtr = *Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", block);
+ new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(itemsType, 0U, "items_ptr", block);
const auto array = GenNewArray(ctx, count, itemsPtr, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
const auto move = BasicBlock::Create(context, "move", ctx.Func);
const auto work = BasicBlock::Create(context, "work", ctx.Func);
@@ -1254,8 +1257,8 @@ public:
BranchInst::Create(move, last, many, block);
block = move;
- const auto mptr = GetElementPtrInst::CreateInBounds(bits, {idx}, "mptr", block);
- const auto load = new LoadInst(mptr, "load", block);
+ const auto mptr = GetElementPtrInst::CreateInBounds(maskType, bits, {idx}, "mptr", block);
+ const auto load = new LoadInst(maskType, mptr, "load", block);
const auto six = BinaryOperator::CreateAdd(one, ConstantInt::get(one->getType(), 64), "six", block);
const auto inc = BinaryOperator::CreateAdd(idx, plusSize, "inc", block);
@@ -1292,10 +1295,10 @@ public:
block = copy;
- const auto src = GetElementPtrInst::CreateInBounds(elements, {one0}, "src", block);
- const auto dst = GetElementPtrInst::CreateInBounds(items, {two0}, "dst", block);
+ const auto src = GetElementPtrInst::CreateInBounds(list->getType(), elements, {one0}, "src", block);
+ const auto dst = GetElementPtrInst::CreateInBounds(list->getType(), items, {two0}, "dst", block);
- const auto item = new LoadInst(src, "item", block);
+ const auto item = new LoadInst(list->getType(), src, "item", block);
ValueAddRef(Item->GetRepresentation(), item, ctx, block);
new StoreInst(item, dst, block);
@@ -1320,7 +1323,7 @@ public:
const auto fnType = FunctionType::get(Type::getVoidTy(context), {bits->getType(), shr->getType()}, false);
const auto name = "MyFree";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyFree));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
CallInst::Create(func, {bits, shr}, "", block);
out->addIncoming(output, block);
@@ -1337,15 +1340,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType(), limit->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- const auto value = CallInst::Create(doFuncPtr, {self, ctx.Ctx, list, limit}, "value", block);
+ const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list, limit}, "value", block);
out->addIncoming(value, block);
} else {
const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block);
new StoreInst(list, resultPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType(), limit->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr, limit}, "", block);
- const auto value = new LoadInst(resultPtr, "value", block);
+ CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr, limit}, "", block);
+ const auto value = new LoadInst(list->getType(), resultPtr, "value", block);
out->addIncoming(value, block);
}
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_flatmap.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_flatmap.cpp
index 811d2463eca..1ddeee2a77f 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_flatmap.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_flatmap.cpp
@@ -55,9 +55,10 @@ public:
const auto step = BasicBlock::Create(context, "step", ctx.Func);
const auto exit = BasicBlock::Create(context, "exit", ctx.Func);
- const auto result = PHINode::Create(Type::getInt128Ty(context), 2U, "result", exit);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto result = PHINode::Create(valueType, 2U, "result", exit);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto reset = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, state, GetInvalid(context), "reset", block);
BranchInst::Create(init, work, reset, block);
@@ -151,7 +152,7 @@ public:
const auto resultType = Type::getInt32Ty(context);
const auto result = PHINode::Create(resultType, 2U, "result", exit);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(Type::getInt128Ty(context), statePtr, "state", block);
const auto reset = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, state, GetInvalid(context), "reset", block);
BranchInst::Create(init, work, reset, block);
@@ -246,10 +247,11 @@ public:
const auto done = BasicBlock::Create(context, "done", ctx.Func);
const auto exit = BasicBlock::Create(context, "exit", ctx.Func);
- const auto result = PHINode::Create(Type::getInt128Ty(context), 3U, "result", exit);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto result = PHINode::Create(valueType, 3U, "result", exit);
result->addIncoming(GetFinish(context), block);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto choise = SwitchInst::Create(state, work, 2U, block);
choise->addCase(GetInvalid(context), init);
choise->addCase(GetFinish(context), exit);
@@ -266,7 +268,7 @@ public:
block = next;
- const auto iterator = new LoadInst(statePtr, "iterator", block);
+ const auto iterator = new LoadInst(valueType, statePtr, "iterator", block);
const auto itemPtr = codegenInput->CreateRefValue(ctx, block);
const auto status = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::Next>(Type::getInt1Ty(context), iterator, ctx.Codegen, block, itemPtr);
BranchInst::Create(work, done, status, block);
@@ -349,7 +351,8 @@ public:
const auto result = PHINode::Create(resultType, 3U, "result", exit);
result->addIncoming(ConstantInt::get(resultType, i32(EFetchResult::Finish)), block);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto choise = SwitchInst::Create(state, work, 2U, block);
choise->addCase(GetInvalid(context), init);
choise->addCase(GetFinish(context), exit);
@@ -366,7 +369,7 @@ public:
block = next;
- const auto iterator = new LoadInst(statePtr, "iterator", block);
+ const auto iterator = new LoadInst(valueType, statePtr, "iterator", block);
const auto itemPtr = codegenInput->CreateRefValue(ctx, block);
const auto status = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::Next>(Type::getInt1Ty(context), iterator, ctx.Codegen, block, itemPtr);
BranchInst::Create(work, done, status, block);
@@ -461,9 +464,10 @@ public:
const auto step = BasicBlock::Create(context, "step", ctx.Func);
const auto exit = BasicBlock::Create(context, "exit", ctx.Func);
- const auto result = PHINode::Create(Type::getInt128Ty(context), 2U, "result", exit);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto result = PHINode::Create(valueType, 2U, "result", exit);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto reset = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, state, GetInvalid(context), "reset", block);
BranchInst::Create(init, work, reset, block);
@@ -625,7 +629,7 @@ public:
block = more;
- const auto current = new LoadInst(currentPtr, "current", block);
+ const auto current = new LoadInst(valueType, currentPtr, "current", block);
BranchInst::Create(pull, skip, HasValue(current, block), block);
{
@@ -646,7 +650,7 @@ public:
}
block = good;
- const auto value = new LoadInst(valuePtr, "value", block);
+ const auto value = new LoadInst(valueType, valuePtr, "value", block);
ValueRelease(static_cast<const IComputationNode*>(this)->GetRepresentation(), value, ctx, block);
result->addIncoming(value, block);
BranchInst::Create(over, block);
@@ -824,7 +828,7 @@ public:
block = more;
- const auto current = new LoadInst(currentPtr, "current", block);
+ const auto current = new LoadInst(valueType, currentPtr, "current", block);
BranchInst::Create(pull, skip, HasValue(current, block), block);
{
@@ -845,7 +849,7 @@ public:
}
block = good;
- const auto value = new LoadInst(valuePtr, "value", block);
+ const auto value = new LoadInst(valueType, valuePtr, "value", block);
ValueRelease(static_cast<const IComputationNode*>(this)->GetRepresentation(), value, ctx, block);
result->addIncoming(value, block);
BranchInst::Create(over, block);
@@ -1184,7 +1188,7 @@ protected:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
@@ -1256,11 +1260,11 @@ protected:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto zero = ConstantInt::get(valueType, 0);
- const auto init = new LoadInst(currentArg, "init", block);
+ const auto init = new LoadInst(valueType, currentArg, "init", block);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
@@ -1298,7 +1302,7 @@ protected:
CleanupBoxed(list, ctx, block);
}
- const auto iter = new LoadInst(currentArg, "iter", block);
+ const auto iter = new LoadInst(valueType, currentArg, "iter", block);
current->addIncoming(iter, block);
BranchInst::Create(pass, block);
@@ -1480,7 +1484,7 @@ public:
const auto array = *this->Stateless || ctx.AlwaysInline ?
new AllocaInst(arrayType, 0U, "array", &ctx.Func->getEntryBlock().back()):
new AllocaInst(arrayType, 0U, "array", block);
- const auto ptr = GetElementPtrInst::CreateInBounds(array, {zeroSize, zeroSize}, "ptr", block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(arrayType, array, {zeroSize, zeroSize}, "ptr", block);
vector->addIncoming(ptr, block);
BranchInst::Create(main, block);
@@ -1492,7 +1496,7 @@ public:
const auto fnType = FunctionType::get(vector->getType(), {size->getType()}, false);
const auto name = "MyArrayAlloc";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyArrayAlloc));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
const auto ptr = CallInst::Create(func, {size}, "ptr", block);
vector->addIncoming(ptr, block);
BranchInst::Create(main, block);
@@ -1521,10 +1525,10 @@ public:
BranchInst::Create(next, stop, more, block);
block = next;
- const auto src = GetElementPtrInst::CreateInBounds(elements, {index}, "src", block);
- const auto item = new LoadInst(src, "item", block);
+ const auto src = GetElementPtrInst::CreateInBounds(list->getType(), elements, {index}, "src", block);
+ const auto item = new LoadInst(list->getType(), src, "item", block);
codegenItem->CreateSetValue(ctx, block, item);
- const auto dst = GetElementPtrInst::CreateInBounds(vector, {idx}, "dst", block);
+ const auto dst = GetElementPtrInst::CreateInBounds(list->getType(), vector, {idx}, "dst", block);
GetNodeValue(dst, this->NewItem, ctx, block);
const auto inc = BinaryOperator::CreateAdd(index, plusSize, "inc", block);
@@ -1532,7 +1536,7 @@ public:
if constexpr (!IsMultiRowPerItem) {
const auto plus = BinaryOperator::CreateAdd(idx, plusSize, "plus", block);
- const auto load = new LoadInst(dst, "load", block);
+ const auto load = new LoadInst(list->getType(), dst, "load", block);
new StoreInst(GetOptionalValue(context, load, block), dst, block);
const auto move = SelectInst::Create(IsExists(load, block), plus, idx, "move", block);
idx->addIncoming(move, block);
@@ -1548,11 +1552,12 @@ public:
Value* res;
if constexpr (!IsMultiRowPerItem) {
+ const auto newType = PointerType::getUnqual(list->getType());
const auto newPtr = *this->Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "new_ptr", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "new_ptr", block);
+ new AllocaInst(newType, 0U, "new_ptr", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(newType, 0U, "new_ptr", block);
res = GenNewArray(ctx, idx, newPtr, block);
- const auto target = new LoadInst(newPtr, "target", block);
+ const auto target = new LoadInst(newType, newPtr, "target", block);
const auto pType = PointerType::getUnqual(Type::getInt8Ty(context));
const auto pdst = CastInst::Create(Instruction::BitCast, target, pType, "pdst", block);
@@ -1560,7 +1565,7 @@ public:
const auto bytes = BinaryOperator::CreateShl(idx, ConstantInt::get(idx->getType(), 4), "bytes", block);
const auto fnType = FunctionType::get(Type::getVoidTy(context), {pType, pType, bytes->getType(), Type::getInt1Ty(context)}, false);
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction("llvm.memcpy.p0i8.p0i8.i64", fnType).getCallee();
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction("llvm.memcpy.p0i8.p0i8.i64", fnType);
CallInst::Create(func, {pdst, psrc, bytes, ConstantInt::getFalse(context)}, "", block);
} else {
const auto factory = ctx.GetFactory();
@@ -1570,13 +1575,13 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), vector->getType(), index->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- res = CallInst::Create(funcPtr, {factory, vector, index}, "res", block);
+ res = CallInst::Create(funType, funcPtr, {factory, vector, index}, "res", block);
} else {
const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), vector->getType(), index->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, retPtr, vector, index}, "", block);
- res = new LoadInst(retPtr, "res", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, vector, index}, "", block);
+ res = new LoadInst(list->getType(), retPtr, "res", block);
}
}
map->addIncoming(res, block);
@@ -1588,7 +1593,7 @@ public:
const auto fnType = FunctionType::get(Type::getVoidTy(context), {vector->getType(), size->getType()}, false);
const auto name = "MyArrayFree";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&MyArrayFree));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
CallInst::Create(func, {vector, size}, "", block);
map->addIncoming(res, block);
@@ -1605,15 +1610,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- const auto value = CallInst::Create(doFuncPtr, {self, ctx.Ctx, list}, "value", block);
+ const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
map->addIncoming(value, block);
} else {
const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block);
new StoreInst(list, resultPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
- const auto value = new LoadInst(resultPtr, "value", block);
+ CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
+ const auto value = new LoadInst(list->getType(), resultPtr, "value", block);
map->addIncoming(value, block);
}
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_flow.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_flow.cpp
index 5d677791474..3505e54681e 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_flow.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_flow.cpp
@@ -41,7 +41,7 @@ public:
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto main = BasicBlock::Create(context, "main", ctx.Func);
- const auto load = new LoadInst(statePtr, "load", block);
+ const auto load = new LoadInst(valueType, statePtr, "load", block);
const auto state = PHINode::Create(load->getType(), 2U, "state", main);
state->addIncoming(load, block);
@@ -58,7 +58,7 @@ public:
CleanupBoxed(list, ctx, block);
}
- const auto save = new LoadInst(statePtr, "save", block);
+ const auto save = new LoadInst(valueType, statePtr, "save", block);
state->addIncoming(save, block);
BranchInst::Create(main, block);
@@ -92,7 +92,7 @@ public:
}
block = good;
- const auto value = new LoadInst(valuePtr, "value", block);
+ const auto value = new LoadInst(valueType, valuePtr, "value", block);
ValueRelease(static_cast<const IComputationNode*>(this)->GetRepresentation(), value, ctx, block);
result->addIncoming(value, block);
BranchInst::Create(done, block);
@@ -133,12 +133,13 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
auto& context = ctx.Codegen->GetContext();
+ const auto valueType = Type::getInt128Ty(context);
const auto main = BasicBlock::Create(context, "main", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
- const auto load = new LoadInst(statePtr, "load", block);
- const auto result = PHINode::Create(load->getType(), 2U, "state", done);
+ const auto load = new LoadInst(valueType, statePtr, "load", block);
+ const auto result = PHINode::Create(valueType, 2U, "state", done);
result->addIncoming(load, block);
BranchInst::Create(done, main, IsFinish(load, block), block);
@@ -242,7 +243,6 @@ private:
auto& module = codegen->GetModule();
auto& context = codegen->GetContext();
-
const auto& name = TBaseComputation::MakeName("Fetch");
if (const auto f = module.getFunction(name.c_str()))
return f;
@@ -266,7 +266,7 @@ private:
SafeUnRefUnboxed(valuePtr, ctx, block);
GetNodeValue(valuePtr, Flow, ctx, block);
- const auto value = new LoadInst(valuePtr, "value", block);
+ const auto value = new LoadInst(valueType, valuePtr, "value", block);
const auto second = SelectInst::Create(IsYield(value, block), ConstantInt::get(statusType, static_cast<ui32>(NUdf::EFetchStatus::Yield)), ConstantInt::get(statusType, static_cast<ui32>(NUdf::EFetchStatus::Ok)), "second", block);
const auto first = SelectInst::Create(IsFinish(value, block), ConstantInt::get(statusType, static_cast<ui32>(NUdf::EFetchStatus::Finish)), second, "second", block);
@@ -404,7 +404,7 @@ private:
const ui32 StubsIndex;
};
-} // namespace
+} // namespace
IComputationNode* WrapToFlow(TCallable& callable, const TComputationNodeFactoryContext& ctx) {
MKQL_ENSURE(callable.GetInputsCount() == 1, "Expected 1 args, got " << callable.GetInputsCount());
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_fold.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_fold.cpp
index 15d912e49df..e9380a2d3b5 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_fold.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_fold.cpp
@@ -81,8 +81,8 @@ public:
BranchInst::Create(good, done, more, block);
block = good;
- const auto itemPtr = GetElementPtrInst::CreateInBounds(elements, {index}, "item_ptr", block);
- const auto item = new LoadInst(itemPtr, "item", block);
+ const auto itemPtr = GetElementPtrInst::CreateInBounds(valueType, elements, {index}, "item_ptr", block);
+ const auto item = new LoadInst(valueType, itemPtr, "item", block);
codegenItem->CreateSetValue(ctx, block, item);
@@ -103,7 +103,7 @@ public:
new AllocaInst(valueType, 0U, "iter_ptr", &ctx.Func->getEntryBlock().back()):
new AllocaInst(valueType, 0U, "iter_ptr", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListIterator>(iterPtr, list, ctx.Codegen, block);
- const auto iter = new LoadInst(iterPtr, "iter", block);
+ const auto iter = new LoadInst(valueType, iterPtr, "iter", block);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_fold1.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_fold1.cpp
index e6fab3f0a35..9aca6f3ff72 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_fold1.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_fold1.cpp
@@ -80,8 +80,8 @@ public:
block = next;
- const auto item1Ptr = GetElementPtrInst::CreateInBounds(elements, {nil}, "item1_ptr", block);
- const auto item1 = new LoadInst(item1Ptr, "item1", block);
+ const auto item1Ptr = GetElementPtrInst::CreateInBounds(valueType, elements, {nil}, "item1_ptr", block);
+ const auto item1 = new LoadInst(valueType, item1Ptr, "item1", block);
codegenItem->CreateSetValue(ctx, block, item1);
const auto init = GetNodeValue(InitialState, ctx, block);
@@ -99,8 +99,8 @@ public:
block = good;
- const auto itemPtr = GetElementPtrInst::CreateInBounds(elements, {index}, "item_ptr", block);
- const auto item = new LoadInst(itemPtr, "item", block);
+ const auto itemPtr = GetElementPtrInst::CreateInBounds(valueType, elements, {index}, "item_ptr", block);
+ const auto item = new LoadInst(valueType, itemPtr, "item", block);
codegenItem->CreateSetValue(ctx, block, item);
@@ -128,7 +128,7 @@ public:
new AllocaInst(valueType, 0U, "iter_ptr", &ctx.Func->getEntryBlock().back()):
new AllocaInst(valueType, 0U, "iter_ptr", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListIterator>(iterPtr, list, ctx.Codegen, block);
- const auto iter = new LoadInst(iterPtr, "iter", block);
+ const auto iter = new LoadInst(valueType, iterPtr, "iter", block);
const auto stop = BasicBlock::Create(context, "stop", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_fromstring.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_fromstring.cpp
index b8cecf6af12..bb9440286a4 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_fromstring.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_fromstring.cpp
@@ -62,7 +62,7 @@ public:
return NUdf::TUnboxedValuePod(v);
}
- if (IsStrict) {
+ if constexpr (IsStrict) {
Throw(data, Precision, Scale);
} else {
return NUdf::TUnboxedValuePod();
@@ -79,14 +79,10 @@ public:
const auto name = "DecimalFromString";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalFromString));
- llvm::Value* func;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
- const auto fnType = FunctionType::get(valType, { valType, psType, psType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- } else {
- const auto fnType = FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, psType, psType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- }
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ FunctionType::get(valType, { valType, psType, psType }, false):
+ FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, psType, psType }, false);
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
const auto zero = ConstantInt::get(valType, 0ULL);
const auto precision = ConstantInt::get(psType, Precision);
@@ -100,7 +96,7 @@ public:
const auto last = ways > 0U ? BasicBlock::Create(context, "last", ctx.Func) : nullptr;
const auto phi = last ? PHINode::Create(valType, ways + 1U, "result", last) : nullptr;
- if (IsOptional) {
+ if constexpr (IsOptional) {
phi->addIncoming(zero, block);
const auto check = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, value, zero, "check", block);
@@ -116,7 +112,7 @@ public:
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
new StoreInst(value, retPtr, block);
CallInst::Create(func, { retPtr, retPtr, precision, scale }, "", block);
- decimal = new LoadInst(retPtr, "res", block);
+ decimal = new LoadInst(valType, retPtr, "res", block);
}
if (Data->IsTemporaryValue())
@@ -127,10 +123,11 @@ public:
{
block = fail;
- if (IsStrict) {
+ if constexpr (IsStrict) {
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TDecimalFromStringWrapper::Throw));
- const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(FunctionType::get(Type::getVoidTy(context), {valType, psType, psType}, false)), "thrower", block);
- CallInst::Create(doFuncPtr, { value, precision, scale }, "", block);
+ const auto doFuncType = FunctionType::get(Type::getVoidTy(context), {valType, psType, psType}, false);
+ const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(doFuncType), "thrower", block);
+ CallInst::Create(doFuncType, doFuncPtr, { value, precision, scale }, "", block);
new UnreachableInst(context, block);
} else {
phi->addIncoming(zero, block);
@@ -140,7 +137,7 @@ public:
block = good;
- if (IsOptional || !IsStrict) {
+ if constexpr (IsOptional || !IsStrict) {
phi->addIncoming(SetterForInt128(decimal, block), block);
BranchInst::Create(last, block);
@@ -185,7 +182,7 @@ public:
return out;
}
- if (IsStrict) {
+ if constexpr (IsStrict) {
Throw(data, SchemeType);
} else {
return NUdf::TUnboxedValuePod();
@@ -202,14 +199,10 @@ public:
const auto name = "DataFromString";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DataFromString));
- llvm::Value* func;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
- const auto fnType = FunctionType::get(valType, { valType, slotType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- } else {
- const auto fnType = FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, slotType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- }
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ FunctionType::get(valType, { valType, slotType }, false):
+ FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, slotType }, false);
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
const auto zero = ConstantInt::get(valType, 0ULL);
const auto slot = ConstantInt::get(slotType, static_cast<ui32>(SchemeType));
@@ -219,7 +212,7 @@ public:
const auto last = IsOptional || fail ? BasicBlock::Create(context, "last", ctx.Func) : nullptr;
const auto phi = IsOptional ? PHINode::Create(valType, 2U, "result", last) : nullptr;
- if (IsOptional) {
+ if constexpr (IsOptional) {
phi->addIncoming(zero, block);
const auto check = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, value, zero, "check", block);
@@ -235,30 +228,31 @@ public:
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
new StoreInst(value, retPtr, block);
CallInst::Create(func, { retPtr, retPtr, slot }, "", block);
- data = new LoadInst(retPtr, "res", block);
+ data = new LoadInst(valType, retPtr, "res", block);
}
if (Data->IsTemporaryValue())
ValueCleanup(Data->GetRepresentation(), value, ctx, block);
- if (IsOptional) {
+ if constexpr (IsOptional) {
phi->addIncoming(data, block);
}
- if (IsStrict) {
+ if constexpr (IsStrict) {
const auto test = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, data, zero, "test", block);
BranchInst::Create(fail, last, test, block);
block = fail;
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TFromStringWrapper::Throw));
- const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(FunctionType::get(Type::getVoidTy(context), {valType, slotType}, false)), "thrower", block);
- CallInst::Create(doFuncPtr, { value, slot }, "", block);
+ const auto doFuncType = FunctionType::get(Type::getVoidTy(context), {valType, slotType}, false);
+ const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(doFuncType), "thrower", block);
+ CallInst::Create(doFuncType, doFuncPtr, { value, slot }, "", block);
new UnreachableInst(context, block);
- } else if (IsOptional) {
+ } else if constexpr (IsOptional) {
BranchInst::Create(last, block);
}
- if (IsOptional || IsStrict) {
+ if constexpr (IsOptional || IsStrict) {
block = last;
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_grace_join.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_grace_join.cpp
index f94ced2d5fa..6055d70f80e 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_grace_join.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_grace_join.cpp
@@ -49,7 +49,7 @@ struct TGraceJoinPacker {
ui64 TuplesPacked = 0; // Total number of packed tuples
ui64 TuplesBatchPacked = 0; // Number of tuples packed during current join batch
ui64 TuplesUnpacked = 0; // Total number of unpacked tuples
- ui64 BatchSize = PartialJoinBatchSize; // Batch size for partial table packing and join
+ ui64 BatchSize = PartialJoinBatchSize; // Batch size for partial table packing and join
std::chrono::time_point<std::chrono::system_clock> StartTime; // Start time of execution
std::chrono::time_point<std::chrono::system_clock> EndTime; // End time of execution
std::vector<ui64> TupleIntVals; // Packed value of all fixed length values of table tuple. Keys columns should be packed first.
@@ -108,7 +108,7 @@ TColumnDataPackInfo GetPackInfo(TType* type) {
res.DataType = NUdf::EDataSlot::String;
res.Name = pgType->GetName();
} else {
- res.IsIType = true;
+ res.IsIType = true;
}
return res;
}
@@ -426,7 +426,7 @@ TGraceJoinPacker::TGraceJoinPacker(const std::vector<TType *> & columnTypes, con
auto colType = columnTypes[i];
auto packInfo = GetPackInfo(colType);
packInfo.ColumnIdx = i;
-
+
ui32 keyColNums = std::count_if(keyColumns.begin(), keyColumns.end(), [&](ui32 k) {return k == i;});
@@ -449,7 +449,7 @@ TGraceJoinPacker::TGraceJoinPacker(const std::vector<TType *> & columnTypes, con
ui64 totalStrColumnsNum = nColumns - totalIntColumnsNum - totalIColumnsNum;
ui64 keyIntColumnsNum = std::count_if(ColumnsPackInfo.begin(), ColumnsPackInfo.end(), [](TColumnDataPackInfo a) { return (a.IsKeyColumn && !a.IsString && !a.IsPgType);});
- ui64 keyIColumnsNum = std::count_if(ColumnsPackInfo.begin(), ColumnsPackInfo.end(), [](TColumnDataPackInfo a) { return (a.IsKeyColumn && a.IsIType);});
+ ui64 keyIColumnsNum = std::count_if(ColumnsPackInfo.begin(), ColumnsPackInfo.end(), [](TColumnDataPackInfo a) { return (a.IsKeyColumn && a.IsIType);});
ui64 keyStrColumnsNum = nKeyColumns - keyIntColumnsNum - keyIColumnsNum;
ui64 dataIntColumnsNum = totalIntColumnsNum - keyIntColumnsNum;
ui64 dataStrColumnsNum = totalStrColumnsNum - keyStrColumnsNum;
@@ -457,7 +457,7 @@ TGraceJoinPacker::TGraceJoinPacker(const std::vector<TType *> & columnTypes, con
TotalColumnsNum = nColumns;
TotalIntColumnsNum = totalIntColumnsNum;
TotalStrColumnsNum = totalStrColumnsNum;
- TotalIColumnsNum = totalIColumnsNum;
+ TotalIColumnsNum = totalIColumnsNum;
KeyIntColumnsNum = keyIntColumnsNum;
@@ -490,7 +490,7 @@ TGraceJoinPacker::TGraceJoinPacker(const std::vector<TType *> & columnTypes, con
return false;
});
-
+
Offsets.resize(nColumns);
TupleHolder.resize(nColumns);
TupleStringHolder.resize(nColumns);
@@ -511,7 +511,7 @@ TGraceJoinPacker::TGraceJoinPacker(const std::vector<TType *> & columnTypes, con
for( auto & p: ColumnsPackInfo ) {
if ( !p.IsString && !p.IsIType ) {
if (prevKeyColumn && !p.IsKeyColumn) {
- currIntOffset = ( (currIntOffset + sizeof(ui64) - 1) / sizeof(ui64) ) * sizeof(ui64);
+ currIntOffset = ( (currIntOffset + sizeof(ui64) - 1) / sizeof(ui64) ) * sizeof(ui64);
}
prevKeyColumn = p.IsKeyColumn;
p.Offset = currIntOffset;
@@ -566,7 +566,7 @@ public:
, LeftKeyColumns(leftKeyColumns)
, RightKeyColumns(rightKeyColumns)
, LeftRenames(leftRenames)
- , RightRenames(rightRenames)
+ , RightRenames(rightRenames)
{
if (JoinKind == EJoinKind::Full || JoinKind == EJoinKind::Exclusion ) {
LeftPacker->BatchSize = std::numeric_limits<ui64>::max();
@@ -650,14 +650,13 @@ class TGraceJoinWrapper : public TStatefulWideFlowCodegeneratorNode<TGraceJoinWr
std::vector<Value*> pointers;
pointers.reserve(getters.size());
for (auto i = 0U; i < getters.size(); ++i) {
- pointers.emplace_back(GetElementPtrInst::CreateInBounds(values, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, (TString("ptr_") += ToString(i)).c_str(), atTop));
+ pointers.emplace_back(GetElementPtrInst::CreateInBounds(arrayType, values, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, (TString("ptr_") += ToString(i)).c_str(), atTop));
initV = InsertValueInst::Create(initV, ConstantInt::get(valueType, 0), {i}, (TString("zero_") += ToString(i)).c_str(), atTop);
initF = InsertValueInst::Create(initF, pointers.back(), {i}, (TString("insert_") += ToString(i)).c_str(), atTop);
- getters[i] = [i, values](const TCodegenContext& ctx, BasicBlock*& block) {
- const auto indexType = Type::getInt32Ty(ctx.Codegen->GetContext());
- const auto pointer = GetElementPtrInst::CreateInBounds(values, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, (TString("ptr_") += ToString(i)).c_str(), block);
- return new LoadInst(pointer, (TString("load_") += ToString(i)).c_str(), block);
+ getters[i] = [i, values, indexType, arrayType, valueType](const TCodegenContext& ctx, BasicBlock*& block) {
+ const auto pointer = GetElementPtrInst::CreateInBounds(arrayType, values, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, (TString("ptr_") += ToString(i)).c_str(), block);
+ return new LoadInst(valueType, pointer, (TString("load_") += ToString(i)).c_str(), block);
};
}
@@ -680,7 +679,7 @@ class TGraceJoinWrapper : public TStatefulWideFlowCodegeneratorNode<TGraceJoinWr
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TGraceJoinWrapper::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
@@ -691,14 +690,14 @@ class TGraceJoinWrapper : public TStatefulWideFlowCodegeneratorNode<TGraceJoinWr
new StoreInst(initV, values, block);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TGraceJoinState::FetchValues));
const auto funcType = FunctionType::get(Type::getInt32Ty(context), { statePtrType, ctx.Ctx->getType(), fields->getType() }, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funcType), "fetch_func", block);
- const auto result = CallInst::Create(funcPtr, { stateArg, ctx.Ctx, fields }, "fetch", block);
+ const auto result = CallInst::Create(funcType, funcPtr, { stateArg, ctx.Ctx, fields }, "fetch", block);
for (ui32 i = 0U; i < OutputRepresentations.size(); ++i) {
ValueRelease(OutputRepresentations[i], pointers[i], ctx, block);
@@ -758,7 +757,7 @@ EFetchResult TGraceJoinState::FetchValues(TComputationContext& ctx, NUdf::TUnbox
}
for (ui32 i = 0; i < RightRenames.size() / 2; i++)
- {
+ {
auto & valPtr = output[RightRenames[2 * i + 1]];
if ( valPtr ) {
*valPtr = valsRight[RightRenames[2 * i]];
@@ -832,7 +831,7 @@ EFetchResult TGraceJoinState::FetchValues(TComputationContext& ctx, NUdf::TUnbox
*PartialJoinCompleted = true;
JoinedTablePtr->Join(*LeftPacker->TablePtr, *RightPacker->TablePtr, JoinKind, *HaveMoreLeftRows, *HaveMoreRightRows);
JoinedTablePtr->ResetIterator();
-
+
}
@@ -840,7 +839,7 @@ EFetchResult TGraceJoinState::FetchValues(TComputationContext& ctx, NUdf::TUnbox
*PartialJoinCompleted = true;
JoinedTablePtr->Join(*LeftPacker->TablePtr, *RightPacker->TablePtr, JoinKind, *HaveMoreLeftRows, *HaveMoreRightRows);
JoinedTablePtr->ResetIterator();
-
+
}
if (!*HaveMoreRightRows && !*HaveMoreLeftRows && !*PartialJoinCompleted) {
@@ -849,9 +848,9 @@ EFetchResult TGraceJoinState::FetchValues(TComputationContext& ctx, NUdf::TUnbox
RightPacker->StartTime = std::chrono::system_clock::now();
JoinedTablePtr->Join(*LeftPacker->TablePtr, *RightPacker->TablePtr, JoinKind, *HaveMoreLeftRows, *HaveMoreRightRows);
JoinedTablePtr->ResetIterator();
- LeftPacker->EndTime = std::chrono::system_clock::now();
+ LeftPacker->EndTime = std::chrono::system_clock::now();
RightPacker->EndTime = std::chrono::system_clock::now();
-
+
}
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_guess.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_guess.cpp
index 0e0c734a5ed..0eb5f6a00aa 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_guess.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_guess.cpp
@@ -47,7 +47,7 @@ public:
const auto none = BasicBlock::Create(context, "none", ctx.Func);
- if (IsOptional) {
+ if constexpr (IsOptional) {
const auto good = BasicBlock::Create(context, "good", ctx.Func);
BranchInst::Create(none, good, IsEmpty(var, block), block);
@@ -112,7 +112,7 @@ public:
block = box;
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetVariantItem>(pointer, var, ctx.Codegen, block);
- const auto load = new LoadInst(pointer, "load", block);
+ const auto load = new LoadInst(valueType, pointer, "load", block);
new StoreInst(MakeOptional(context, load, block), pointer, block);
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_heap.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_heap.cpp
index 0867c5c120a..c26f85abe03 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_heap.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_heap.cpp
@@ -76,9 +76,10 @@ public:
block = work;
+ const auto itemsType = PointerType::getUnqual(valueType);
const auto itemsPtr = *Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(valueType), 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(valueType), 0U, "items_ptr", block);
+ new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(itemsType, 0U, "items_ptr", block);
const auto idxType = Type::getInt32Ty(context);
@@ -86,14 +87,14 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {fact->getType(), list->getType(), itemsPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- array = CallInst::Create(funcPtr, {fact, list, itemsPtr}, "array", block);
+ array = CallInst::Create(funType, funcPtr, {fact, list, itemsPtr}, "array", block);
} else {
const auto arrayPtr = new AllocaInst(valueType, 0U, "array_ptr", block);
new StoreInst(list, arrayPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {fact->getType(), arrayPtr->getType(), arrayPtr->getType(), itemsPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {fact, arrayPtr, arrayPtr, itemsPtr}, "", block);
- array = new LoadInst(arrayPtr, "array", block);
+ CallInst::Create(funType, funcPtr, {fact, arrayPtr, arrayPtr, itemsPtr}, "", block);
+ array = new LoadInst(valueType, arrayPtr, "array", block);
}
result->addIncoming(array, block);
@@ -101,16 +102,16 @@ public:
const auto algo = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THeapWrapper::Do));
const auto self = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(this));
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
const auto zero = ConstantInt::get(idxType, 0);
- const auto begin = GetElementPtrInst::CreateInBounds(items, {zero}, "begin", block);
- const auto end = GetElementPtrInst::CreateInBounds(items, {size}, "end", block);
+ const auto begin = GetElementPtrInst::CreateInBounds(valueType, items, {zero}, "begin", block);
+ const auto end = GetElementPtrInst::CreateInBounds(valueType, items, {size}, "end", block);
const auto selfPtr = CastInst::Create(Instruction::IntToPtr, self, PointerType::getUnqual(StructType::get(context)), "comp", block);
const auto doType = FunctionType::get(Type::getVoidTy(context), {selfPtr->getType(), ctx.Ctx->getType(), begin->getType(), end->getType()}, false);
const auto doPtr = CastInst::Create(Instruction::IntToPtr, algo, PointerType::getUnqual(doType), "do", block);
- CallInst::Create(doPtr, {selfPtr, ctx.Ctx, begin, end}, "", block);
+ CallInst::Create(doType, doPtr, {selfPtr, ctx.Ctx, begin, end}, "", block);
BranchInst::Create(done, block);
@@ -260,9 +261,10 @@ public:
block = work;
+ const auto itemsType = PointerType::getUnqual(valueType);
const auto itemsPtr = *Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(valueType), 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(valueType), 0U, "items_ptr", block);
+ new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(itemsType, 0U, "items_ptr", block);
const auto idxType = Type::getInt32Ty(context);
@@ -270,14 +272,14 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {fact->getType(), list->getType(), itemsPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- array = CallInst::Create(funcPtr, {fact, list, itemsPtr}, "array", block);
+ array = CallInst::Create(funType, funcPtr, {fact, list, itemsPtr}, "array", block);
} else {
const auto arrayPtr = new AllocaInst(valueType, 0U, "array_ptr", block);
new StoreInst(list, arrayPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {fact->getType(), arrayPtr->getType(), arrayPtr->getType(), itemsPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {fact, arrayPtr, arrayPtr, itemsPtr}, "", block);
- array = new LoadInst(arrayPtr, "array", block);
+ CallInst::Create(funType, funcPtr, {fact, arrayPtr, arrayPtr, itemsPtr}, "", block);
+ array = new LoadInst(valueType, arrayPtr, "array", block);
}
result->addIncoming(array, block);
@@ -285,17 +287,17 @@ public:
const auto algo = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TNthWrapper::Do));
const auto self = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(this));
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
const auto zero = ConstantInt::get(idxType, 0);
- const auto begin = GetElementPtrInst::CreateInBounds(items, {zero}, "begin", block);
- const auto mid = GetElementPtrInst::CreateInBounds(items, {min}, "middle", block);
- const auto end = GetElementPtrInst::CreateInBounds(items, {size}, "end", block);
+ const auto begin = GetElementPtrInst::CreateInBounds(valueType, items, {zero}, "begin", block);
+ const auto mid = GetElementPtrInst::CreateInBounds(valueType, items, {min}, "middle", block);
+ const auto end = GetElementPtrInst::CreateInBounds(valueType, items, {size}, "end", block);
const auto selfPtr = CastInst::Create(Instruction::IntToPtr, self, PointerType::getUnqual(StructType::get(context)), "comp", block);
const auto doType = FunctionType::get(Type::getVoidTy(context), {selfPtr->getType(), ctx.Ctx->getType(), begin->getType(), mid->getType(), end->getType()}, false);
const auto doPtr = CastInst::Create(Instruction::IntToPtr, algo, PointerType::getUnqual(doType), "do", block);
- CallInst::Create(doPtr, {selfPtr, ctx.Ctx, begin, mid, end}, "", block);
+ CallInst::Create(doType, doPtr, {selfPtr, ctx.Ctx, begin, mid, end}, "", block);
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_if.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_if.cpp
index ac25b71031d..4767b9b8ed7 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_if.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_if.cpp
@@ -122,8 +122,9 @@ public:
block = test;
- const auto state = new LoadInst(statePtr, "state", block);
- const auto result = PHINode::Create(state->getType(), IsOptional ? 3U : 2U, "result", done);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
+ const auto result = PHINode::Create(valueType, IsOptional ? 3U : 2U, "result", done);
if (IsOptional) {
result->addIncoming(state, block);
@@ -203,7 +204,8 @@ public:
block = test;
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto result = PHINode::Create(Type::getInt32Ty(context), 2, "result", done);
const auto cast = CastInst::Create(Instruction::Trunc, state, Type::getInt1Ty(context), "bool", block);
@@ -237,10 +239,11 @@ public:
const auto then = BasicBlock::Create(context, "then", ctx.Func);
const auto elsb = BasicBlock::Create(context, "elsb", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
- const auto result = PHINode::Create(Type::getInt128Ty(context), 2, "result", done);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto result = PHINode::Create(valueType, 2, "result", done);
- const auto statePtr = GetElementPtrInst::CreateInBounds(ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), index)}, "state_ptr", block);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto statePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), index)}, "state_ptr", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto trunc = CastInst::Create(Instruction::Trunc, state, Type::getInt1Ty(context), "trunc", block);
BranchInst::Create(then, elsb, trunc, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_iterator.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_iterator.cpp
index 8eccbb27b5c..39f94a66fb6 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_iterator.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_iterator.cpp
@@ -32,15 +32,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto signature = FunctionType::get(value->getType(), {factory->getType(), value->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
- const auto output = CallInst::Create(creator, {factory, value}, "output", block);
+ const auto output = CallInst::Create(signature, creator, {factory, value}, "output", block);
return output;
} else {
const auto place = new AllocaInst(value->getType(), 0U, "place", block);
new StoreInst(value, place, block);
const auto signature = FunctionType::get(Type::getVoidTy(context), {factory->getType(), place->getType(), place->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
- CallInst::Create(creator, {factory, place, place}, "", block);
- const auto output = new LoadInst(place, "output", block);
+ CallInst::Create(signature, creator, {factory, place, place}, "", block);
+ const auto output = new LoadInst(value->getType(), place, "output", block);
return output;
}
}
@@ -78,15 +78,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto signature = FunctionType::get(value->getType(), {factory->getType(), value->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
- const auto output = CallInst::Create(creator, {factory, value}, "output", block);
+ const auto output = CallInst::Create(signature, creator, {factory, value}, "output", block);
return output;
} else {
const auto place = new AllocaInst(value->getType(), 0U, "place", block);
new StoreInst(value, place, block);
const auto signature = FunctionType::get(Type::getVoidTy(context), {factory->getType(), place->getType(), place->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
- CallInst::Create(creator, {factory, place, place}, "", block);
- const auto output = new LoadInst(place, "output", block);
+ CallInst::Create(signature, creator, {factory, place, place}, "", block);
+ const auto output = new LoadInst(value->getType(), place, "output", block);
return output;
}
}
@@ -219,7 +219,7 @@ private:
SafeUnRefUnboxed(valuePtr, ctx, block);
GetNodeValue(valuePtr, Flow, ctx, block);
- const auto value = new LoadInst(valuePtr, "value", block);
+ const auto value = new LoadInst(valueType, valuePtr, "value", block);
const auto kill = BasicBlock::Create(context, "kill", ctx.Func);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
@@ -228,8 +228,9 @@ private:
block = kill;
const auto doThrow = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TFlowForwardListWrapper::Throw));
- const auto doThrowPtr = CastInst::Create(Instruction::IntToPtr, doThrow, PointerType::getUnqual(FunctionType::get(Type::getVoidTy(context), {}, false)), "thrower", block);
- CallInst::Create(doThrowPtr, {}, "", block)->setTailCall();
+ const auto doThrowType = FunctionType::get(Type::getVoidTy(context), {}, false);
+ const auto doThrowPtr = CastInst::Create(Instruction::IntToPtr, doThrow, PointerType::getUnqual(doThrowType), "thrower", block);
+ CallInst::Create(doThrowType, doThrowPtr, {}, "", block)->setTailCall();
new UnreachableInst(context, block);
block = good;
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_join.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_join.cpp
index 3164ad4eeed..bbfa8f830d6 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_join.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_join.cpp
@@ -1179,14 +1179,13 @@ public:
std::vector<Value*> pointers;
pointers.reserve(size);
for (auto i = 0U; i < size; ++i) {
- pointers.emplace_back(GetElementPtrInst::CreateInBounds(values, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, (TString("ptr_") += ToString(i)).c_str(), atTop));
+ pointers.emplace_back(GetElementPtrInst::CreateInBounds(arrayType, values, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, (TString("ptr_") += ToString(i)).c_str(), atTop));
initV = InsertValueInst::Create(initV, ConstantInt::get(valueType, 0), {i}, (TString("zero_") += ToString(i)).c_str(), atTop);
initF = InsertValueInst::Create(initF, pointers.back(), {i}, (TString("insert_") += ToString(i)).c_str(), atTop);
- getters[i] = [i, values](const TCodegenContext& ctx, BasicBlock*& block) {
- const auto indexType = Type::getInt32Ty(ctx.Codegen->GetContext());
- const auto pointer = GetElementPtrInst::CreateInBounds(values, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, (TString("ptr_") += ToString(i)).c_str(), block);
- return new LoadInst(pointer, (TString("load_") += ToString(i)).c_str(), block);
+ getters[i] = [i, values, valueType, indexType, arrayType](const TCodegenContext& ctx, BasicBlock*& block) {
+ const auto pointer = GetElementPtrInst::CreateInBounds(arrayType, values, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, (TString("ptr_") += ToString(i)).c_str(), block);
+ return new LoadInst(valueType, pointer, (TString("load_") += ToString(i)).c_str(), block);
};
}
@@ -1210,7 +1209,7 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TWideCommonJoinCoreWrapper::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
@@ -1221,14 +1220,14 @@ public:
new StoreInst(initV, values, block);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TValue::FetchValues));
const auto funcType = FunctionType::get(Type::getInt32Ty(context), { statePtrType, ctx.Ctx->getType(), fields->getType() }, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funcType), "fetch_func", block);
- const auto result = CallInst::Create(funcPtr, { stateArg, ctx.Ctx, fields }, "fetch", block);
+ const auto result = CallInst::Create(funcType, funcPtr, { stateArg, ctx.Ctx, fields }, "fetch", block);
for (ui32 i = 0U; i < OutputRepresentations.size(); ++i) {
ValueRelease(OutputRepresentations[i], pointers[i], ctx, block);
@@ -1329,7 +1328,7 @@ private:
block = good;
- const auto fields = new LoadInst(outputArg, "fields", block);
+ const auto fields = new LoadInst(arrayType, outputArg, "fields", block);
for (ui32 i = 0U; i < InputRepresentations.size(); ++i) {
const auto save = BasicBlock::Create(context, (TString("save_") += ToString(i)).c_str(), ctx.Func);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_join_dict.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_join_dict.cpp
index 194a4cb15e3..994ec3a7f7c 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_join_dict.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_join_dict.cpp
@@ -53,7 +53,7 @@ public:
const auto joinFuncType = FunctionType::get(Type::getInt128Ty(context),
{ joinFuncArg->getType(), ctx.Ctx->getType(), one->getType(), two->getType() }, false);
const auto joinFuncPtr = CastInst::Create(Instruction::IntToPtr, joinFunc, PointerType::getUnqual(joinFuncType), "cast", block);
- const auto join = CallInst::Create(joinFuncPtr, { joinFuncArg, ctx.Ctx, one, two }, "join", block);
+ const auto join = CallInst::Create(joinFuncType, joinFuncPtr, { joinFuncArg, ctx.Ctx, one, two }, "join", block);
AddRefBoxed(join, ctx, block);
new StoreInst(join, pointer, block);
} else {
@@ -66,8 +66,8 @@ public:
{ joinFuncArg->getType(), pointer->getType(), ctx.Ctx->getType(), onePtr->getType(), twoPtr->getType() }, false);
const auto joinFuncPtr = CastInst::Create(Instruction::IntToPtr, joinFunc, PointerType::getUnqual(joinFuncType), "cast", block);
- CallInst::Create(joinFuncPtr, { joinFuncArg, pointer, ctx.Ctx, onePtr, twoPtr }, "", block);
- const auto join = new LoadInst(pointer, "join", block);
+ CallInst::Create(joinFuncType, joinFuncPtr, { joinFuncArg, pointer, ctx.Ctx, onePtr, twoPtr }, "", block);
+ const auto join = new LoadInst(Type::getInt128Ty(context), pointer, "join", block);
AddRefBoxed(join, ctx, block);
}
}
@@ -83,7 +83,7 @@ private:
return true;
}
- if (KeyTuple) {
+ if constexpr (KeyTuple) {
for (ui32 index : OptIndicies) {
if (!key.GetElement(index)) {
return true;
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_lazy_list.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_lazy_list.cpp
index eb4524f3477..2678c7f37c7 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_lazy_list.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_lazy_list.cpp
@@ -44,7 +44,7 @@ public:
const auto lazy = PHINode::Create(list->getType(), IsOptional ? 3U : 2U, "lazy", done);
lazy->addIncoming(list, block);
- if (IsOptional) {
+ if constexpr (IsOptional) {
const auto test = BasicBlock::Create(context, "test", ctx.Func);
BranchInst::Create(done, test, IsEmpty(list, block), block);
@@ -63,15 +63,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), list->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto res = CallInst::Create(funcPtr, {factory, list}, "res", block);
+ const auto res = CallInst::Create(funType, funcPtr, {factory, list}, "res", block);
lazy->addIncoming(res, block);
} else {
const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block);
new StoreInst(list, retPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), retPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, retPtr, retPtr}, "", block);
- const auto res = new LoadInst(retPtr, "res", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, retPtr}, "", block);
+ const auto res = new LoadInst(list->getType(), retPtr, "res", block);
lazy->addIncoming(res, block);
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp
index 5eeac1ea865..b3bd9f1f611 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_listfromrange.cpp
@@ -256,6 +256,7 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
auto& context = ctx.Codegen->GetContext();
+ const auto valueType = Type::getInt128Ty(context);
const auto startv = GetNodeValue(Start, ctx, block);
const auto endv = GetNodeValue(End, ctx, block);
@@ -278,16 +279,16 @@ public:
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TListFromRangeWrapper::MakeList));
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
- const auto signature = FunctionType::get(Type::getInt128Ty(context), {ctx.Ctx->getType(), start->getType(), end->getType(), step->getType(), timezone->getType()}, false);
+ const auto signature = FunctionType::get(valueType, {ctx.Ctx->getType(), start->getType(), end->getType(), step->getType(), timezone->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
- const auto output = CallInst::Create(creator, {ctx.Ctx, start, end, step, timezone}, "output", block);
+ const auto output = CallInst::Create(signature, creator, {ctx.Ctx, start, end, step, timezone}, "output", block);
return output;
} else {
- const auto place = new AllocaInst(Type::getInt128Ty(context), 0U, "place", block);
+ const auto place = new AllocaInst(valueType, 0U, "place", block);
const auto signature = FunctionType::get(Type::getVoidTy(context), {place->getType(), ctx.Ctx->getType(), start->getType(), end->getType(), step->getType(), timezone->getType()}, false);
const auto creator = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(signature), "creator", block);
- CallInst::Create(creator, {place, ctx.Ctx, start, end, step, timezone}, "", block);
- const auto output = new LoadInst(place, "output", block);
+ CallInst::Create(signature, creator, {place, ctx.Ctx, start, end, step, timezone}, "", block);
+ const auto output = new LoadInst(valueType, place, "output", block);
return output;
}
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_lookup.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_lookup.cpp
index 732fe3d5fa7..9eeea71ce20 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_lookup.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_lookup.cpp
@@ -26,7 +26,7 @@ public:
const auto dict = GetNodeValue(Dict, ctx, block);
GetNodeValue(pointer, Key, ctx, block);
- const auto keyp = new LoadInst(pointer, "key", block);
+ const auto keyp = new LoadInst(Type::getInt128Ty(ctx.Codegen->GetContext()), pointer, "key", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::Lookup>(pointer, dict, ctx.Codegen, block, pointer);
ValueUnRef(Key->GetRepresentation(), keyp, ctx, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_map.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_map.cpp
index 04997bd1f1d..66612e6cf05 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_map.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_map.cpp
@@ -215,7 +215,7 @@ protected:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
@@ -345,10 +345,10 @@ public:
const auto size = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListLength>(Type::getInt64Ty(context), list, ctx.Codegen, block);
const auto itemsPtr = *Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", block);
+ new AllocaInst(elementsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(elementsType, 0U, "items_ptr", block);
const auto array = GenNewArray(ctx, size, itemsPtr, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(elementsType, itemsPtr, "items", block);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -366,10 +366,10 @@ public:
BranchInst::Create(next, stop, more, block);
block = next;
- const auto src = GetElementPtrInst::CreateInBounds(elements, {index}, "src", block);
- const auto item = new LoadInst(src, "item", block);
+ const auto src = GetElementPtrInst::CreateInBounds(list->getType(), elements, {index}, "src", block);
+ const auto item = new LoadInst(list->getType(), src, "item", block);
codegenItem->CreateSetValue(ctx, block, item);
- const auto dst = GetElementPtrInst::CreateInBounds(items, {index}, "dst", block);
+ const auto dst = GetElementPtrInst::CreateInBounds(list->getType(), items, {index}, "dst", block);
GetNodeValue(dst, NewItem, ctx, block);
const auto plus = BinaryOperator::CreateAdd(index, ConstantInt::get(size->getType(), 1), "plus", block);
@@ -393,15 +393,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- const auto value = CallInst::Create(doFuncPtr, {self, ctx.Ctx, list}, "value", block);
+ const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
map->addIncoming(value, block);
} else {
const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block);
new StoreInst(list, resultPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
- const auto value = new LoadInst(resultPtr, "value", block);
+ CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
+ const auto value = new LoadInst(list->getType(), resultPtr, "value", block);
map->addIncoming(value, block);
}
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_map_join.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_map_join.cpp
index b37f588c707..3bae7d6ad02 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_map_join.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_map_join.cpp
@@ -52,7 +52,7 @@ protected:
const auto zero = ConstantInt::get(Type::getInt128Ty(context), 0);
const auto keys = KeyTuple.GenNewArray(LeftKeyColumns.size(), itemsPtr, ctx, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsPtr->getType()->getPointerElementType(), itemsPtr, "items", block);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
const auto result = PHINode::Create(Type::getInt1Ty(context), (LeftKeyColumns.size() + 1U) << 1U , "result", done);
@@ -60,7 +60,7 @@ protected:
const auto keyType = AS_TYPE(TTupleType, DictType->GetKeyType());
for (ui32 i = 0; i < LeftKeyColumns.size(); ++i) {
const auto index = ConstantInt::get(idxType, i);
- const auto ptr = GetElementPtrInst::CreateInBounds(items, {ConstantInt::get(idxType, 0), index}, (TString("ptr_") += ToString(i)).c_str(), block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(items->getType()->getPointerElementType(), items, {ConstantInt::get(idxType, 0), index}, (TString("ptr_") += ToString(i)).c_str(), block);
const auto elem = getters[LeftKeyColumns[i]](ctx, block);
const auto converter = reinterpret_cast<TGeneratorPtr>(LeftKeyConverters[i].Generator);
const auto conv = converter ? converter(reinterpret_cast<Value *const *>(&elem), ctx, block) : elem;
@@ -87,7 +87,7 @@ protected:
void GenFillLeftStruct(const std::vector<Value*>& pointers, ICodegeneratorInlineWideNode::TGettersList& output) const {
for (auto i = 0U; i < pointers.size(); ++i) {
- output[LeftRenames[(i << 1U) + 1U]] = [p = pointers[i]](const TCodegenContext&, BasicBlock*& block) { return new LoadInst(p, "value", block); };
+ output[LeftRenames[(i << 1U) + 1U]] = [p = pointers[i]](const TCodegenContext&, BasicBlock*& block) { return new LoadInst(p->getType()->getPointerElementType(), p, "value", block); };
}
}
@@ -126,19 +126,18 @@ protected:
const auto item = new AllocaInst(valueType, 0U, "item", atTop);
const auto placeholder = new AllocaInst(stub->getType(), 0U, "placeholder", atTop);
- const auto pointer = GetElementPtrInst::CreateInBounds(ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), idx)}, "pointer", atTop);
+ const auto pointer = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), idx)}, "pointer", atTop);
for (auto i = 0U; i < RightRenames.size(); ++i) {
const auto from = RightRenames[i];
const auto to = RightRenames[++i];
const auto kind = OutputRepresentations[to];
- output[to] = [from, kind, item, pointer, placeholder, arrayType](const TCodegenContext& ctx, BasicBlock*& block) {
+ output[to] = [from, kind, item, pointer, placeholder, arrayType, valueType](const TCodegenContext& ctx, BasicBlock*& block) {
auto& context = ctx.Codegen->GetContext();
const auto index = ConstantInt::get(Type::getInt32Ty(context), from);
- const auto elements = new LoadInst(placeholder, "elements", block);
-
const auto pointerType = PointerType::getUnqual(arrayType);
+ const auto elements = new LoadInst(pointerType, placeholder, "elements", block);
const auto null = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, elements, ConstantPointerNull::get(pointerType), "null", block);
const auto fast = BasicBlock::Create(context, "fast", ctx.Func);
@@ -151,14 +150,14 @@ protected:
block = fast;
- const auto ptr = GetElementPtrInst::CreateInBounds(elements, {ConstantInt::get(Type::getInt32Ty(context), 0), index}, "ptr", block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(arrayType, elements, {ConstantInt::get(Type::getInt32Ty(context), 0), index}, "ptr", block);
out->addIncoming(ptr, block);
BranchInst::Create(done, block);
block = slow;
- const auto value = new LoadInst(pointer, "value", block);
+ const auto value = new LoadInst(valueType, pointer, "value", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElement>(item, value, ctx.Codegen, block, index);
ValueRelease(kind, item, ctx, block);
out->addIncoming(item, block);
@@ -167,7 +166,7 @@ protected:
block = done;
- const auto load = new LoadInst(out, "load", block);
+ const auto load = new LoadInst(valueType, out, "load", block);
return load;
};
}
@@ -377,7 +376,7 @@ public:
ValueUnRef(EValueRepresentation::Boxed, lookupPtr, ctx, block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::Lookup>(lookupPtr, dict, ctx.Codegen, block, keysPtr);
- const auto lookup = new LoadInst(lookupPtr, "lookup", block);
+ const auto lookup = new LoadInst(valueType, lookupPtr, "lookup", block);
const auto ok = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, lookup, zero, "ok", block);
const auto full = BasicBlock::Create(context, "full", ctx.Func);
@@ -488,7 +487,7 @@ public:
auto i = 0U;
const auto values = ctx.GetMutables();
std::generate_n(std::back_inserter(leftStoragePointers), TBase::LeftRenames.size() >> 1U,
- [&](){ return GetElementPtrInst::CreateInBounds(values, {ConstantInt::get(resultType, LeftRenamesStorageIndex + i++)}, (TString("left_out_") += ToString(i)).c_str(), &ctx.Func->getEntryBlock().back()); });
+ [&](){ return GetElementPtrInst::CreateInBounds(valueType, values, {ConstantInt::get(resultType, LeftRenamesStorageIndex + i++)}, (TString("left_out_") += ToString(i)).c_str(), &ctx.Func->getEntryBlock().back()); });
const auto work = BasicBlock::Create(context, "work", ctx.Func);
@@ -496,7 +495,7 @@ public:
block = work;
- const auto subiter = new LoadInst(iteraratorPtr, "subiter", block);
+ const auto subiter = new LoadInst(valueType, iteraratorPtr, "subiter", block);
const auto hasi = BasicBlock::Create(context, "hasi", ctx.Func);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
@@ -544,7 +543,7 @@ public:
{
block = full;
- const auto item = new LoadInst(itemPtr, "item", block);
+ const auto item = new LoadInst(valueType, itemPtr, "item", block);
const auto elements = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElements>(std::get<1U>(output)->getType(), item, ctx.Codegen, block);
new StoreInst(elements, std::get<0U>(output), block);
@@ -583,7 +582,7 @@ public:
ValueUnRef(EValueRepresentation::Boxed, itemPtr, ctx, block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::Lookup>(itemPtr, dict, ctx.Codegen, block, keysPtr);
- const auto lookup = new LoadInst(itemPtr, "lookup", block);
+ const auto lookup = new LoadInst(valueType, itemPtr, "lookup", block);
const auto ok = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, lookup, zero, "ok", block);
if constexpr (RightRequired)
@@ -702,7 +701,8 @@ protected:
void GenFillLeftStruct(Value* left, Value* items, const TCodegenContext& ctx, BasicBlock*& block) const {
auto& context = ctx.Codegen->GetContext();
const auto idxType = Type::getInt32Ty(context);
- const auto ptrType = PointerType::getUnqual(Type::getInt128Ty(context));
+ const auto valType = Type::getInt128Ty(context);
+ const auto ptrType = PointerType::getUnqual(valType);
const auto elements = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElements>(ptrType, left, ctx.Codegen, block);
const auto null = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, elements, ConstantPointerNull::get(ptrType), "null", block);
@@ -719,9 +719,9 @@ protected:
const auto newI = LeftRenames[i++];
const auto oldIndex = ConstantInt::get(idxType, oldI);
const auto newIndex = ConstantInt::get(idxType, newI);
- const auto oldPtr = GetElementPtrInst::CreateInBounds(elements, {oldIndex}, "old", block);
- const auto newPtr = GetElementPtrInst::CreateInBounds(items, {ConstantInt::get(idxType, 0), newIndex}, "new", block);
- const auto item = new LoadInst(oldPtr, "item", block);
+ const auto oldPtr = GetElementPtrInst::CreateInBounds(valType, elements, {oldIndex}, "old", block);
+ const auto newPtr = GetElementPtrInst::CreateInBounds(items->getType()->getPointerElementType(), items, {ConstantInt::get(idxType, 0), newIndex}, "new", block);
+ const auto item = new LoadInst(valType, oldPtr, "item", block);
new StoreInst(item, newPtr, block);
ValueAddRef(OutputRepresentations[newI], newPtr, ctx, block);
}
@@ -734,7 +734,7 @@ protected:
const auto newI = LeftRenames[i++];
const auto oldIndex = ConstantInt::get(idxType, oldI);
const auto newIndex = ConstantInt::get(idxType, newI);
- const auto item = GetElementPtrInst::CreateInBounds(items, {ConstantInt::get(idxType, 0), newIndex}, "item", block);
+ const auto item = GetElementPtrInst::CreateInBounds(items->getType()->getPointerElementType(), items, {ConstantInt::get(idxType, 0), newIndex}, "item", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElement>(item, left, ctx.Codegen, block, oldIndex);
}
BranchInst::Create(done, block);
@@ -745,7 +745,8 @@ protected:
void GenFillRightStruct(Value* right, Value* items, const TCodegenContext& ctx, BasicBlock*& block) const {
auto& context = ctx.Codegen->GetContext();
const auto idxType = Type::getInt32Ty(context);
- const auto ptrType = PointerType::getUnqual(Type::getInt128Ty(context));
+ const auto valType = Type::getInt128Ty(context);
+ const auto ptrType = PointerType::getUnqual(valType);
const auto elements = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElements>(ptrType, right, ctx.Codegen, block);
const auto null = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, elements, ConstantPointerNull::get(ptrType), "null", block);
@@ -762,9 +763,9 @@ protected:
const auto newI = RightRenames[i++];
const auto oldIndex = ConstantInt::get(idxType, oldI);
const auto newIndex = ConstantInt::get(idxType, newI);
- const auto oldPtr = GetElementPtrInst::CreateInBounds(elements, {oldIndex}, "old", block);
- const auto newPtr = GetElementPtrInst::CreateInBounds(items, {ConstantInt::get(idxType, 0), newIndex}, "new", block);
- const auto elem = new LoadInst(oldPtr, "elem", block);
+ const auto oldPtr = GetElementPtrInst::CreateInBounds(valType, elements, {oldIndex}, "old", block);
+ const auto newPtr = GetElementPtrInst::CreateInBounds(items->getType()->getPointerElementType(), items, {ConstantInt::get(idxType, 0), newIndex}, "new", block);
+ const auto elem = new LoadInst(valType, oldPtr, "elem", block);
new StoreInst(elem, newPtr, block);
ValueAddRef(OutputRepresentations[newI], newPtr, ctx, block);
}
@@ -777,7 +778,7 @@ protected:
const auto newI = RightRenames[i++];
const auto oldIndex = ConstantInt::get(idxType, oldI);
const auto newIndex = ConstantInt::get(idxType, newI);
- const auto item = GetElementPtrInst::CreateInBounds(items, {ConstantInt::get(idxType, 0), newIndex}, "item", block);
+ const auto item = GetElementPtrInst::CreateInBounds(items->getType()->getPointerElementType(), items, {ConstantInt::get(idxType, 0), newIndex}, "item", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElement>(item, right, ctx.Codegen, block, oldIndex);
}
BranchInst::Create(done, block);
@@ -793,13 +794,13 @@ protected:
const auto index = ConstantInt::get(idxType, LeftKeyColumns.front());
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElement>(keysPtr, current, ctx.Codegen, block, index);
if (const auto converter = reinterpret_cast<TGeneratorPtr>(LeftKeyConverters.front().Generator)) {
- Value *const elem = new LoadInst(keysPtr, "elem", block);
+ Value *const elem = new LoadInst(keysPtr->getType()->getPointerElementType(), keysPtr, "elem", block);
const auto conv = converter(&elem, ctx, block);
new StoreInst(conv, keysPtr, block);
const auto check = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, conv, zero, "check", block);
return check;
} else {
- const auto keys = new LoadInst(keysPtr, "keys", block);
+ const auto keys = new LoadInst(keysPtr->getType()->getPointerElementType(), keysPtr, "keys", block);
const auto check = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, keys, zero, "check", block);
return check;
}
@@ -808,12 +809,13 @@ protected:
Value* GenMakeKeysTuple(Value* keysPtr, Value* current, Value* itemsPtr, const TCodegenContext& ctx, BasicBlock*& block) const {
auto& context = ctx.Codegen->GetContext();
const auto idxType = Type::getInt32Ty(context);
- const auto zero = ConstantInt::get(Type::getInt128Ty(context), 0);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto zero = ConstantInt::get(valueType, 0);
const auto keys = KeyTuple.GenNewArray(LeftKeyColumns.size(), itemsPtr, ctx, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsPtr->getType()->getPointerElementType(), itemsPtr, "items", block);
- const auto ptrType = PointerType::getUnqual(Type::getInt128Ty(context));
+ const auto ptrType = PointerType::getUnqual(valueType);
const auto elements = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElements>(ptrType, current, ctx.Codegen, block);
const auto null = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, elements, ConstantPointerNull::get(ptrType), "null", block);
@@ -831,9 +833,9 @@ protected:
for (ui32 i = 0; i < LeftKeyColumns.size(); ++i) {
const auto oldIndex = ConstantInt::get(idxType, LeftKeyColumns[i]);
const auto newIndex = ConstantInt::get(idxType, i);
- const auto oldPtr = GetElementPtrInst::CreateInBounds(elements, {oldIndex}, "old", block);
- const auto newPtr = GetElementPtrInst::CreateInBounds(items, {ConstantInt::get(idxType, 0), newIndex}, "new", block);
- const auto elem = new LoadInst(oldPtr, "elem", block);
+ const auto oldPtr = GetElementPtrInst::CreateInBounds(valueType, elements, {oldIndex}, "old", block);
+ const auto newPtr = GetElementPtrInst::CreateInBounds(items->getType()->getPointerElementType(), items, {ConstantInt::get(idxType, 0), newIndex}, "new", block);
+ const auto elem = new LoadInst(valueType, oldPtr, "elem", block);
const auto converter = reinterpret_cast<TGeneratorPtr>(LeftKeyConverters[i].Generator);
const auto conv = converter ? converter(reinterpret_cast<Value *const *>(&elem), ctx, block) : elem;
@@ -856,12 +858,12 @@ protected:
block = slow;
for (ui32 i = 0; i < LeftKeyColumns.size(); ++i) {
- const auto item = GetElementPtrInst::CreateInBounds(items, {ConstantInt::get(idxType, 0), ConstantInt::get(idxType, i)}, "item", block);
+ const auto item = GetElementPtrInst::CreateInBounds(items->getType()->getPointerElementType(), items, {ConstantInt::get(idxType, 0), ConstantInt::get(idxType, i)}, "item", block);
const auto index = ConstantInt::get(idxType, LeftKeyColumns[i]);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElement>(item, current, ctx.Codegen, block, index);
const auto next = BasicBlock::Create(context, (TString("next_") += ToString(i)).c_str(), ctx.Func);
- const auto elem = new LoadInst(item, "elem", block);
+ const auto elem = new LoadInst(valueType, item, "elem", block);
if (const auto converter = reinterpret_cast<TGeneratorPtr>(LeftKeyConverters[i].Generator)) {
const auto conv = converter(reinterpret_cast<Value *const *>(&elem), ctx, block);
@@ -1016,10 +1018,11 @@ public:
const auto valueType = Type::getInt128Ty(context);
const auto zero = ConstantInt::get(valueType, 0);
- const auto itemsType = ArrayType::get(valueType, this->OutputRepresentations.size());
+ const auto arrayType = ArrayType::get(valueType, this->OutputRepresentations.size());
const auto keysType = IsTuple ? ArrayType::get(valueType, this->LeftKeyColumns.size()) : nullptr;
- const auto itemsPtr = new AllocaInst(PointerType::getUnqual(itemsType), 0U, "items_ptr", &ctx.Func->getEntryBlock().back());
+ const auto itemsType = PointerType::getUnqual(arrayType);
+ const auto itemsPtr = new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back());
const auto kitmsPtr = IsTuple ? new AllocaInst(PointerType::getUnqual(keysType), 0U, "kitms_ptr", &ctx.Func->getEntryBlock().back()) : nullptr;
const auto keysPtr = new AllocaInst(valueType, 0U, "keys_ptr", &ctx.Func->getEntryBlock().back());
@@ -1078,7 +1081,7 @@ public:
ValueUnRef(GetValueRepresentation(this->DictType->GetKeyType()), keysPtr, ctx, block);
}
- const auto lookup = new LoadInst(itemPtr, "lookup", block);
+ const auto lookup = new LoadInst(valueType, itemPtr, "lookup", block);
const auto ok = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, lookup, zero, "ok", block);
const auto full = BasicBlock::Create(context, "full", ctx.Func);
@@ -1089,7 +1092,7 @@ public:
block = full;
const auto out = this->ResStruct.GenNewArray(this->OutputRepresentations.size(), itemsPtr, ctx, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
this->GenFillLeftStruct(current, items, ctx, block);
this->GenFillRightStruct(lookup, items, ctx, block);
@@ -1110,7 +1113,7 @@ public:
block = half;
const auto out = this->ResStruct.GenNewArray(this->OutputRepresentations.size(), itemsPtr, ctx, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
this->GenFillLeftStruct(current, items, ctx, block);
@@ -1138,10 +1141,11 @@ public:
const auto valueType = Type::getInt128Ty(context);
const auto zero = ConstantInt::get(valueType, 0);
- const auto itemsType = ArrayType::get(valueType, this->OutputRepresentations.size());
+ const auto arrayType = ArrayType::get(valueType, this->OutputRepresentations.size());
const auto keysType = IsTuple ? ArrayType::get(valueType, this->LeftKeyColumns.size()) : nullptr;
- const auto itemsPtr = new AllocaInst(PointerType::getUnqual(itemsType), 0U, "items_ptr", &ctx.Func->getEntryBlock().back());
+ const auto itemsType = PointerType::getUnqual(arrayType);
+ const auto itemsPtr = new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back());
const auto kitmsPtr = IsTuple ? new AllocaInst(PointerType::getUnqual(keysType), 0U, "kitms_ptr", &ctx.Func->getEntryBlock().back()) : nullptr;
const auto keysPtr = new AllocaInst(valueType, 0U, "keys_ptr", &ctx.Func->getEntryBlock().back());
@@ -1153,7 +1157,7 @@ public:
block = work;
- const auto subiter = new LoadInst(iteraratorPtr, "subiter", block);
+ const auto subiter = new LoadInst(valueType, iteraratorPtr, "subiter", block);
const auto hasi = BasicBlock::Create(context, "hasi", ctx.Func);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
@@ -1168,7 +1172,7 @@ public:
BranchInst::Create(hasi, part, HasValue(subiter, block), block);
block = hasi;
- const auto curr = new LoadInst(currentPtr, "curr", block);
+ const auto curr = new LoadInst(valueType, currentPtr, "curr", block);
const auto status = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::Next>(Type::getInt1Ty(context), subiter, ctx.Codegen, block, itemPtr);
BranchInst::Create(full, skip, status, block);
@@ -1176,8 +1180,8 @@ public:
block = full;
const auto out = this->ResStruct.GenNewArray(this->OutputRepresentations.size(), itemsPtr, ctx, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
- const auto item = new LoadInst(itemPtr, "item", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
+ const auto item = new LoadInst(valueType, itemPtr, "item", block);
this->GenFillLeftStruct(curr, items, ctx, block);
this->GenFillRightStruct(item, items, ctx, block);
@@ -1203,7 +1207,7 @@ public:
block = loop;
GetNodeValue(currentPtr, this->Stream, ctx, block);
- const auto current = new LoadInst(currentPtr, "current", block);
+ const auto current = new LoadInst(valueType, currentPtr, "current", block);
BranchInst::Create(stop, next, IsSpecial(current, block), block);
block = stop;
@@ -1233,7 +1237,7 @@ public:
ValueUnRef(GetValueRepresentation(this->DictType->GetKeyType()), keysPtr, ctx, block);
}
- const auto lookup = new LoadInst(itemPtr, "lookup", block);
+ const auto lookup = new LoadInst(valueType, itemPtr, "lookup", block);
const auto ok = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, lookup, zero, "ok", block);
const auto fill = BasicBlock::Create(context, "fill", ctx.Func);
@@ -1249,7 +1253,7 @@ public:
BranchInst::Create(loop, block);
} else {
const auto out = this->ResStruct.GenNewArray(this->OutputRepresentations.size(), itemsPtr, ctx, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
this->GenFillLeftStruct(current, items, ctx, block);
UnRefBoxed(current, ctx, block);
@@ -1513,7 +1517,7 @@ private:
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto itemsType = ArrayType::get(valueType, this->OutputRepresentations.size());
+ const auto arrayType = ArrayType::get(valueType, this->OutputRepresentations.size());
const auto keysType = IsTuple ? ArrayType::get(valueType, this->LeftKeyColumns.size()) : nullptr;
const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
@@ -1535,15 +1539,16 @@ private:
auto block = main;
const auto stream = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(streamArg, "load_stream", false, block) : static_cast<Value*>(streamArg);
+ new LoadInst(valueType, streamArg, "load_stream", false, block) : static_cast<Value*>(streamArg);
const auto dict = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(dictArg, "load_dict", false, block) : static_cast<Value*>(dictArg);
+ new LoadInst(valueType, dictArg, "load_dict", false, block) : static_cast<Value*>(dictArg);
const auto zero = ConstantInt::get(valueType, 0);
const auto fsok = ConstantInt::get(statusType, static_cast<ui32>(NUdf::EFetchStatus::Ok));
- const auto itemsPtr = new AllocaInst(PointerType::getUnqual(itemsType), 0U, "items_ptr", block);
+ const auto itemsType = PointerType::getUnqual(arrayType);
+ const auto itemsPtr = new AllocaInst(itemsType, 0U, "items_ptr", block);
const auto kitmsPtr = IsTuple ? new AllocaInst(PointerType::getUnqual(keysType), 0U, "kitms_ptr", block) : nullptr;
const auto keysPtr = new AllocaInst(valueType, 0U, "keys_ptr", block);
@@ -1565,7 +1570,7 @@ private:
BranchInst::Create(stop, next, stat, block);
block = next;
- const auto current = new LoadInst(itemPtr, "current", block);
+ const auto current = new LoadInst(valueType, itemPtr, "current", block);
const auto none = IsTuple ?
this->GenMakeKeysTuple(keysPtr, current, kitmsPtr, ctx, block):
this->GenMakeKeysTuple(keysPtr, current, ctx, block);
@@ -1601,7 +1606,7 @@ private:
ValueUnRef(GetValueRepresentation(this->DictType->GetKeyType()), keysPtr, ctx, block);
}
- const auto lookup = new LoadInst(itemPtr, "lookup", block);
+ const auto lookup = new LoadInst(valueType, itemPtr, "lookup", block);
const auto ok = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, lookup, zero, "ok", block);
const auto full = BasicBlock::Create(context, "full", ctx.Func);
@@ -1612,7 +1617,7 @@ private:
block = full;
const auto result = this->ResStruct.GenNewArray(this->OutputRepresentations.size(), itemsPtr, ctx, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
this->GenFillLeftStruct(current, items, ctx, block);
this->GenFillRightStruct(lookup, items, ctx, block);
@@ -1636,7 +1641,7 @@ private:
block = half;
const auto result = this->ResStruct.GenNewArray(this->OutputRepresentations.size(), itemsPtr, ctx, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
this->GenFillLeftStruct(current, items, ctx, block);
@@ -1668,7 +1673,7 @@ private:
return f;
const auto valueType = Type::getInt128Ty(context);
- const auto itemsType = ArrayType::get(valueType, this->OutputRepresentations.size());
+ const auto arrayType = ArrayType::get(valueType, this->OutputRepresentations.size());
const auto keysType = IsTuple ? ArrayType::get(valueType, this->LeftKeyColumns.size()) : nullptr;
const auto containerType = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ? static_cast<Type*>(PointerType::getUnqual(valueType)) : static_cast<Type*>(valueType);
const auto contextType = GetCompContextType(context);
@@ -1692,15 +1697,16 @@ private:
auto block = main;
const auto stream = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(streamArg, "load_stream", false, block) : static_cast<Value*>(streamArg);
+ new LoadInst(valueType, streamArg, "load_stream", false, block) : static_cast<Value*>(streamArg);
const auto dict = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(dictArg, "load_dict", false, block) : static_cast<Value*>(dictArg);
+ new LoadInst(valueType, dictArg, "load_dict", false, block) : static_cast<Value*>(dictArg);
const auto zero = ConstantInt::get(valueType, 0);
const auto fsok = ConstantInt::get(statusType, static_cast<ui32>(NUdf::EFetchStatus::Ok));
- const auto itemsPtr = new AllocaInst(PointerType::getUnqual(itemsType), 0U, "items_ptr", block);
+ const auto itemsType = PointerType::getUnqual(arrayType);
+ const auto itemsPtr = new AllocaInst(itemsType, 0U, "items_ptr", block);
const auto kitmsPtr = IsTuple ? new AllocaInst(PointerType::getUnqual(keysType), 0U, "kitms_ptr", block) : nullptr;
const auto keysPtr = new AllocaInst(valueType, 0U, "keys_ptr", block);
@@ -1712,7 +1718,7 @@ private:
block = work;
- const auto subiter = new LoadInst(iteratorArg, "subiter", block);
+ const auto subiter = new LoadInst(valueType, iteratorArg, "subiter", block);
const auto hasi = BasicBlock::Create(context, "hasi", ctx.Func);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
@@ -1739,9 +1745,9 @@ private:
block = full;
const auto result = this->ResStruct.GenNewArray(this->OutputRepresentations.size(), itemsPtr, ctx, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
- const auto curr = new LoadInst(currentArg, "curr", block);
- const auto item = new LoadInst(itemPtr, "item", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
+ const auto curr = new LoadInst(valueType, currentArg, "curr", block);
+ const auto item = new LoadInst(valueType, itemPtr, "item", block);
this->GenFillLeftStruct(curr, items, ctx, block);
this->GenFillRightStruct(item, items, ctx, block);
@@ -1769,7 +1775,7 @@ private:
{
block = next;
- const auto current = new LoadInst(currentArg, "current", block);
+ const auto current = new LoadInst(valueType, currentArg, "current", block);
const auto none = IsTuple ?
this->GenMakeKeysTuple(keysPtr, current, kitmsPtr, ctx, block):
@@ -1789,7 +1795,7 @@ private:
ValueUnRef(GetValueRepresentation(this->DictType->GetKeyType()), keysPtr, ctx, block);
}
- const auto lookup = new LoadInst(itemPtr, "lookup", block);
+ const auto lookup = new LoadInst(valueType, itemPtr, "lookup", block);
const auto ok = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, lookup, zero, "ok", block);
const auto fill = BasicBlock::Create(context, "fill", ctx.Func);
@@ -1800,7 +1806,7 @@ private:
block = hsnt;
const auto result = this->ResStruct.GenNewArray(this->OutputRepresentations.size(), itemsPtr, ctx, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
this->GenFillLeftStruct(current, items, ctx, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_multimap.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_multimap.cpp
index dc4eb919483..9ae50cdea29 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_multimap.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_multimap.cpp
@@ -44,13 +44,14 @@ public:
const auto codegenItem = dynamic_cast<ICodegeneratorExternalNode*>(Item);
MKQL_ENSURE(codegenItem, "Item must be codegenerator node.");
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto zero = BasicBlock::Create(context, "zero", ctx.Func);
const auto work = BasicBlock::Create(context, "work", ctx.Func);
const auto pass = BasicBlock::Create(context, "pass", ctx.Func);
- const auto result = PHINode::Create(state->getType(), NewItems.size() + 1U, "result", pass);
+ const auto result = PHINode::Create(valueType, NewItems.size() + 1U, "result", pass);
const auto choise = SwitchInst::Create(state, zero, NewItems.size() - 1U, block);
@@ -230,11 +231,11 @@ public:
const auto size = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListLength>(Type::getInt64Ty(context), list, ctx.Codegen, block);
const auto itemsPtr = *Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", block);
+ new AllocaInst(elementsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(elementsType, 0U, "items_ptr", block);
const auto full = BinaryOperator::CreateMul(size, ConstantInt::get(size->getType(), NewItems.size()), "full", block);
const auto array = GenNewArray(ctx, full, itemsPtr, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
+ const auto items = new LoadInst(elementsType, itemsPtr, "items", block);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -252,14 +253,14 @@ public:
BranchInst::Create(next, stop, more, block);
block = next;
- const auto src = GetElementPtrInst::CreateInBounds(elements, {index}, "src", block);
- const auto item = new LoadInst(src, "item", block);
+ const auto src = GetElementPtrInst::CreateInBounds(list->getType(), elements, {index}, "src", block);
+ const auto item = new LoadInst(list->getType(), src, "item", block);
codegenItem->CreateSetValue(ctx, block, item);
const auto from = BinaryOperator::CreateMul(index, ConstantInt::get(index->getType(), NewItems.size()), "from", block);
for (ui32 i = 0U; i < NewItems.size(); ++i) {
const auto pos = BinaryOperator::CreateAdd(from, ConstantInt::get(from->getType(), i), (TString("pos_") += ToString(i)).c_str(), block);
- const auto dst = GetElementPtrInst::CreateInBounds(items, {pos}, (TString("dst_") += ToString(i)).c_str(), block);
+ const auto dst = GetElementPtrInst::CreateInBounds(list->getType(), items, {pos}, (TString("dst_") += ToString(i)).c_str(), block);
GetNodeValue(dst, NewItems[i], ctx, block);
}
@@ -284,15 +285,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- const auto value = CallInst::Create(doFuncPtr, {self, ctx.Ctx, list}, "value", block);
+ const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
map->addIncoming(value, block);
} else {
const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block);
new StoreInst(list, resultPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
- const auto value = new LoadInst(resultPtr, "value", block);
+ CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
+ const auto value = new LoadInst(list->getType(), resultPtr, "value", block);
map->addIncoming(value, block);
}
BranchInst::Create(done, block);
@@ -353,9 +354,9 @@ private:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
- const auto position = new LoadInst(positionArg, "position", false, block);
+ const auto position = new LoadInst(positionArg->getType()->getPointerElementType(), positionArg, "position", false, block);
const auto zero = BasicBlock::Create(context, "zero", ctx.Func);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
@@ -449,13 +450,14 @@ public:
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
auto& context = ctx.Codegen->GetContext();
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto zero = BasicBlock::Create(context, "zero", ctx.Func);
const auto work = BasicBlock::Create(context, "work", ctx.Func);
const auto pass = BasicBlock::Create(context, "pass", ctx.Func);
- const auto result = PHINode::Create(state->getType(), NewItems.size() + 1U, "result", pass);
+ const auto result = PHINode::Create(valueType, NewItems.size() + 1U, "result", pass);
const auto choise = SwitchInst::Create(state, zero, NewItems.size() - 1U, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_prepend.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_prepend.cpp
index 6789c4208d0..dad32d33269 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_prepend.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_prepend.cpp
@@ -40,7 +40,7 @@ public:
const auto left = GetNodeValue(Left, ctx, block);
const auto right = GetNodeValue(Right, ctx, block);
- if (IsVoid) {
+ if constexpr (IsVoid) {
const auto work = BasicBlock::Create(context, "work", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
const auto result = PHINode::Create(right->getType(), 2, "result", done);
@@ -56,7 +56,7 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(right->getType(), {factory->getType(), left->getType(), right->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto res = CallInst::Create(funcPtr, {factory, left, right}, "res", block);
+ const auto res = CallInst::Create(funType, funcPtr, {factory, left, right}, "res", block);
result->addIncoming(res, block);
} else {
const auto retPtr = new AllocaInst(right->getType(), 0U, "ret_ptr", block);
@@ -65,8 +65,8 @@ public:
new StoreInst(left, itemPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), itemPtr->getType(), retPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, retPtr, itemPtr, retPtr}, "", block);
- const auto res = new LoadInst(retPtr, "res", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, itemPtr, retPtr}, "", block);
+ const auto res = new LoadInst(right->getType(), retPtr, "res", block);
result->addIncoming(res, block);
}
@@ -78,7 +78,7 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(right->getType(), {factory->getType(), left->getType(), right->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto res = CallInst::Create(funcPtr, {factory, left, right}, "res", block);
+ const auto res = CallInst::Create(funType, funcPtr, {factory, left, right}, "res", block);
return res;
} else {
const auto retPtr = new AllocaInst(right->getType(), 0U, "ret_ptr", block);
@@ -87,8 +87,8 @@ public:
new StoreInst(left, itemPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), itemPtr->getType(), retPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, retPtr, itemPtr, retPtr}, "", block);
- const auto res = new LoadInst(retPtr, "res", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, itemPtr, retPtr}, "", block);
+ const auto res = new LoadInst(right->getType(), retPtr, "res", block);
return res;
}
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_reduce.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_reduce.cpp
index a0bf05f0acf..f2772a990d1 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_reduce.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_reduce.cpp
@@ -105,7 +105,7 @@ public:
new AllocaInst(valueType, 0U, "iter_ptr", &ctx.Func->getEntryBlock().back()):
new AllocaInst(valueType, 0U, "iter_ptr", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListIterator>(iterPtr, list, ctx.Codegen, block);
- const auto iter = new LoadInst(iterPtr, "iter", block);
+ const auto iter = new LoadInst(valueType, iterPtr, "iter", block);
BranchInst::Create(loop, block);
block = loop;
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_removemember.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_removemember.cpp
index bd5f29452c0..59f36dc2bd5 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_removemember.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_removemember.cpp
@@ -61,11 +61,12 @@ public:
const auto ptrType = PointerType::getUnqual(valType);
const auto idxType = Type::getInt32Ty(context);
const auto type = ArrayType::get(valType, newSize);
+ const auto itmsType = PointerType::getUnqual(type);
const auto itms = *Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(type), 0U, "itms", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(type), 0U, "itms", block);
+ new AllocaInst(itmsType, 0U, "itms", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(itmsType, 0U, "itms", block);
const auto result = Cache.GenNewArray(newSize, itms, ctx, block);
- const auto itemsPtr = new LoadInst(itms, "items", block);
+ const auto itemsPtr = new LoadInst(itmsType, itms, "items", block);
const auto array = GetNodeValue(StructObj, ctx, block);
@@ -84,9 +85,9 @@ public:
block = fast;
for (ui32 i = 0; i < Index; ++i) {
const auto index = ConstantInt::get(idxType, i);
- const auto srcPtr = GetElementPtrInst::CreateInBounds(elements, {index}, "src", block);
- const auto dstPtr = GetElementPtrInst::CreateInBounds(itemsPtr, {zero, index}, "dst", block);
- const auto item = new LoadInst(srcPtr, "item", block);
+ const auto srcPtr = GetElementPtrInst::CreateInBounds(valType, elements, {index}, "src", block);
+ const auto dstPtr = GetElementPtrInst::CreateInBounds(type, itemsPtr, {zero, index}, "dst", block);
+ const auto item = new LoadInst(valType, srcPtr, "item", block);
new StoreInst(item, dstPtr, block);
ValueAddRef(Representations[i], dstPtr, ctx, block);
}
@@ -94,9 +95,9 @@ public:
for (ui32 i = Index + 1U; i < Representations.size(); ++i) {
const auto oldIndex = ConstantInt::get(idxType, i);
const auto newIndex = ConstantInt::get(idxType, i - 1U);
- const auto srcPtr = GetElementPtrInst::CreateInBounds(elements, {oldIndex}, "src", block);
- const auto dstPtr = GetElementPtrInst::CreateInBounds(itemsPtr, {zero, newIndex}, "dst", block);
- const auto item = new LoadInst(srcPtr, "item", block);
+ const auto srcPtr = GetElementPtrInst::CreateInBounds(valType, elements, {oldIndex}, "src", block);
+ const auto dstPtr = GetElementPtrInst::CreateInBounds(type, itemsPtr, {zero, newIndex}, "dst", block);
+ const auto item = new LoadInst(valType, srcPtr, "item", block);
new StoreInst(item, dstPtr, block);
ValueAddRef(Representations[i], dstPtr, ctx, block);
}
@@ -106,14 +107,14 @@ public:
block = slow;
for (ui32 i = 0; i < Index; ++i) {
const auto index = ConstantInt::get(idxType, i);
- const auto itemPtr = GetElementPtrInst::CreateInBounds(itemsPtr, {zero, index}, "item", block);
+ const auto itemPtr = GetElementPtrInst::CreateInBounds(type, itemsPtr, {zero, index}, "item", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElement>(itemPtr, array, ctx.Codegen, block, index);
}
for (ui32 i = Index + 1U; i < Representations.size(); ++i) {
const auto oldIndex = ConstantInt::get(idxType, i);
const auto newIndex = ConstantInt::get(idxType, i - 1U);
- const auto itemPtr = GetElementPtrInst::CreateInBounds(itemsPtr, {zero, newIndex}, "item", block);
+ const auto itemPtr = GetElementPtrInst::CreateInBounds(type, itemsPtr, {zero, newIndex}, "item", block);
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetElement>(itemPtr, array, ctx.Codegen, block, oldIndex);
}
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_reverse.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_reverse.cpp
index 4056cfdf670..21076a9c4f9 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_reverse.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_reverse.cpp
@@ -27,11 +27,12 @@ public:
const auto indexType = Type::getInt32Ty(context);
- const auto first = GetElementPtrInst::CreateInBounds(ctx.Ctx, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 0)}, "first", block);
- const auto fourth = GetElementPtrInst::CreateInBounds(ctx.Ctx, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 3)}, "fourth", block);
+ const auto first = GetElementPtrInst::CreateInBounds(GetCompContextType(context), ctx.Ctx, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 0)}, "first", block);
+ const auto fourth = GetElementPtrInst::CreateInBounds(GetCompContextType(context), ctx.Ctx, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 3)}, "fourth", block);
- const auto factory = new LoadInst(first, "factory", block);
- const auto builder = new LoadInst(fourth, "builder", block);
+ const auto structPtrType = PointerType::getUnqual(StructType::get(context));
+ const auto factory = new LoadInst(structPtrType, first, "factory", block);
+ const auto builder = new LoadInst(structPtrType, fourth, "builder", block);
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::ReverseList));
@@ -40,15 +41,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), builder->getType(), list->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto result = CallInst::Create(funcPtr, {factory, builder, list}, "result", block);
+ const auto result = CallInst::Create(funType, funcPtr, {factory, builder, list}, "result", block);
return result;
} else {
const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block);
new StoreInst(list, retPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), builder->getType(), retPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, retPtr, builder, retPtr}, "", block);
- const auto result = new LoadInst(retPtr, "result", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, builder, retPtr}, "", block);
+ const auto result = new LoadInst(list->getType(), retPtr, "result", block);
return result;
}
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_size.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_size.cpp
index 57c42684161..74115e8cbba 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_size.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_size.cpp
@@ -93,10 +93,9 @@ public:
const auto full = SetterFor<ui32>(ssize, context, block);
const auto half = CastInst::Create(Instruction::Trunc, data, Type::getInt64Ty(context), "half", block);
- const auto strPtrType = PointerType::getUnqual(StructType::get(context, {type32, type32, type32, type32}));
- const auto strptr = CastInst::Create(Instruction::IntToPtr, half, strPtrType, "str_ptr", block);
- const auto refptr = GetElementPtrInst::CreateInBounds(strptr, {ConstantInt::get(type32, 0), ConstantInt::get(type32, 1)}, "refptr", block);
- const auto refs = new LoadInst(refptr, "refs", block);
+ const auto strptr = CastInst::Create(Instruction::IntToPtr, half, PointerType::getUnqual(strType), "str_ptr", block);
+ const auto refptr = GetElementPtrInst::CreateInBounds(strType, strptr, {ConstantInt::get(type32, 0), ConstantInt::get(type32, 1)}, "refptr", block);
+ const auto refs = new LoadInst(type32, refptr, "refs", block);
const auto test = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_UGT, refs, ConstantInt::get(refs->getType(), 0), "test", block);
const auto free = BasicBlock::Create(context, "free", ctx.Func);
@@ -109,7 +108,7 @@ public:
const auto fnType = FunctionType::get(Type::getVoidTy(context), {strptr->getType()}, false);
const auto name = "DeleteString";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DeleteString));
- const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
CallInst::Create(func, {strptr}, "", block);
result->addIncoming(full, block);
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_skip.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_skip.cpp
index 6d1905e9fc8..90e8c0639f3 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_skip.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_skip.cpp
@@ -44,15 +44,15 @@ public:
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto main = BasicBlock::Create(context, "main", ctx.Func);
- const auto load = new LoadInst(statePtr, "load", block);
- const auto state = PHINode::Create(load->getType(), 2U, "state", main);
+ const auto load = new LoadInst(valueType, statePtr, "load", block);
+ const auto state = PHINode::Create(valueType, 2U, "state", main);
state->addIncoming(load, block);
BranchInst::Create(init, main, IsInvalid(load, block), block);
block = init;
GetNodeValue(statePtr, Count, ctx, block);
- const auto save = new LoadInst(statePtr, "save", block);
+ const auto save = new LoadInst(valueType, statePtr, "save", block);
state->addIncoming(save, block);
BranchInst::Create(main, block);
@@ -153,15 +153,15 @@ public:
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto main = BasicBlock::Create(context, "main", ctx.Func);
- const auto load = new LoadInst(statePtr, "load", block);
- const auto state = PHINode::Create(load->getType(), 2U, "state", main);
+ const auto load = new LoadInst(valueType, statePtr, "load", block);
+ const auto state = PHINode::Create(valueType, 2U, "state", main);
state->addIncoming(load, block);
BranchInst::Create(init, main, IsInvalid(load, block), block);
block = init;
GetNodeValue(statePtr, Count, ctx, block);
- const auto save = new LoadInst(statePtr, "save", block);
+ const auto save = new LoadInst(valueType, statePtr, "save", block);
state->addIncoming(save, block);
BranchInst::Create(main, block);
@@ -313,15 +313,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), builder->getType(), list->getType(), count->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto result = CallInst::Create(funcPtr, {factory, builder, list, count}, "result", block);
+ const auto result = CallInst::Create(funType, funcPtr, {factory, builder, list, count}, "result", block);
return result;
} else {
const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block);
new StoreInst(list, retPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), builder->getType(), retPtr->getType(), count->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, retPtr, builder, retPtr, count}, "", block);
- const auto result = new LoadInst(retPtr, "result", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, builder, retPtr, count}, "", block);
+ const auto result = new LoadInst(list->getType(), retPtr, "result", block);
return result;
}
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_squeeze_to_list.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_squeeze_to_list.cpp
index 77a7dbf9ddc..34ec53e0acc 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_squeeze_to_list.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_squeeze_to_list.cpp
@@ -109,7 +109,7 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TSqueezeToListWrapper::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), limit->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, limit, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, limit, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
@@ -121,7 +121,7 @@ public:
const auto result = PHINode::Create(valueType, 3U, "result", over);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
@@ -146,7 +146,7 @@ public:
const auto pushType = FunctionType::get(Type::getInt1Ty(context), {stateArg->getType(), arg->getType()}, false);
const auto pushPtr = CastInst::Create(Instruction::IntToPtr, push, PointerType::getUnqual(pushType), "push", block);
- const auto stop = CallInst::Create(pushPtr, {stateArg, arg}, "stop", block);
+ const auto stop = CallInst::Create(pushType, pushPtr, {stateArg, arg}, "stop", block);
BranchInst::Create(done, more, stop, block);
@@ -157,15 +157,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto pullType = FunctionType::get(valueType, {stateArg->getType(), ctx.Ctx->getType()}, false);
const auto pullPtr = CastInst::Create(Instruction::IntToPtr, pull, PointerType::getUnqual(pullType), "pull", block);
- const auto list = CallInst::Create(pullPtr, {stateArg, ctx.Ctx}, "list", block);
+ const auto list = CallInst::Create(pullType, pullPtr, {stateArg, ctx.Ctx}, "list", block);
UnRefBoxed(state, ctx, block);
result->addIncoming(list, block);
} else {
const auto ptr = new AllocaInst(valueType, 0U, "ptr", block);
const auto pullType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), ptr->getType(), ctx.Ctx->getType()}, false);
const auto pullPtr = CastInst::Create(Instruction::IntToPtr, pull, PointerType::getUnqual(pullType), "pull", block);
- CallInst::Create(pullPtr, {stateArg, ptr, ctx.Ctx}, "", block);
- const auto list = new LoadInst(ptr, "list", block);
+ CallInst::Create(pullType, pullPtr, {stateArg, ptr, ctx.Ctx}, "", block);
+ const auto list = new LoadInst(valueType, ptr, "list", block);
UnRefBoxed(state, ctx, block);
result->addIncoming(list, block);
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_switch.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_switch.cpp
index 319effe1a4e..c6ae5bfab6f 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_switch.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_switch.cpp
@@ -79,7 +79,7 @@ public:
TLLVMFieldsStructureForState(llvm::LLVMContext& context)
: TBase(context)
, IndexType(Type::getInt32Ty(context))
- , StatusType(Type::getInt32Ty(context))
+ , StatusType(Type::getInt32Ty(context))
, FieldsCount(GetFields().size())
{
}
@@ -288,11 +288,11 @@ private:
const auto placeholder = NYql::NCodegen::ETarget::Windows == ctx.Codegen->GetEffectiveTarget() ?
new AllocaInst(valueType, 0U, "placeholder", block) : nullptr;
- const auto statePtr = GetElementPtrInst::CreateInBounds(ctx.GetMutables(), {ConstantInt::get(indexType, static_cast<const IComputationNode*>(this)->GetIndex())}, "state_ptr", block);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto statePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(indexType, static_cast<const IComputationNode*>(this)->GetIndex())}, "state_ptr", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
- const auto posPtr = GetElementPtrInst::CreateInBounds(stateArg, { fieldsStruct.This(), fieldsStruct.GetPosition() }, "pos_ptr", block);
+ const auto posPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { fieldsStruct.This(), fieldsStruct.GetPosition() }, "pos_ptr", block);
const auto loop = BasicBlock::Create(context, "loop", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
@@ -302,7 +302,7 @@ private:
block = loop;
- const auto pos = new LoadInst(posPtr, "pos", block);
+ const auto pos = new LoadInst(indexType, posPtr, "pos", block);
const auto getFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TFlowState::Get));
@@ -310,12 +310,12 @@ private:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto getType = FunctionType::get(valueType, {stateArg->getType(), pos->getType()}, false);
const auto getPtr = CastInst::Create(Instruction::IntToPtr, getFunc, PointerType::getUnqual(getType), "get", block);
- input = CallInst::Create(getPtr, {stateArg, pos}, "input", block);
+ input = CallInst::Create(getType, getPtr, {stateArg, pos}, "input", block);
} else {
const auto getType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), placeholder->getType(), pos->getType()}, false);
const auto getPtr = CastInst::Create(Instruction::IntToPtr, getFunc, PointerType::getUnqual(getType), "get", block);
- CallInst::Create(getPtr, {stateArg, placeholder, pos}, "", block);
- input = new LoadInst(placeholder, "input", block);
+ CallInst::Create(getType, getPtr, {stateArg, placeholder, pos}, "", block);
+ input = new LoadInst(valueType, placeholder, "input", block);
}
const auto plus = BinaryOperator::CreateAdd(pos, ConstantInt::get(pos->getType(), 1), "plus", block);
@@ -384,22 +384,22 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TSwitchFlowWrapper::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
- const auto indexPtr = GetElementPtrInst::CreateInBounds(stateArg, { fieldsStruct.This(), fieldsStruct.GetIndex() }, "index_ptr", block);
+ const auto indexPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { fieldsStruct.This(), fieldsStruct.GetIndex() }, "index_ptr", block);
BranchInst::Create(more, block);
block = more;
- const auto index = new LoadInst(indexPtr, "index", block);
+ const auto index = new LoadInst(indexType, indexPtr, "index", block);
const auto empty = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, index, ConstantInt::get(index->getType(), Handlers.size()), "empty", block);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -416,9 +416,9 @@ public:
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
- const auto statusPtr = GetElementPtrInst::CreateInBounds(stateArg, { fieldsStruct.This(), fieldsStruct.GetStatus() }, "last", block);
+ const auto statusPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { fieldsStruct.This(), fieldsStruct.GetStatus() }, "last", block);
- const auto last = new LoadInst(statusPtr, "last", block);
+ const auto last = new LoadInst(statusType, statusPtr, "last", block);
result->addIncoming(GetFinish(context), block);
const auto choise = SwitchInst::Create(last, pull, 2U, block);
@@ -456,7 +456,7 @@ public:
const auto addArg = WrapArgumentForWindows(item, ctx, block);
const auto addType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), addArg->getType()}, false);
const auto addPtr = CastInst::Create(Instruction::IntToPtr, addFunc, PointerType::getUnqual(addType), "add", block);
- CallInst::Create(addPtr, {stateArg, addArg}, "", block);
+ CallInst::Create(addType, addPtr, {stateArg, addArg}, "", block);
const auto check = CheckAdjustedMemLimit<TrackRss>(MemLimit, used, ctx, block);
BranchInst::Create(done, loop, check, block);
@@ -468,7 +468,7 @@ public:
const auto statFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TFlowState::PushStat));
const auto statType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), stat->getType()}, false);
const auto statPtr = CastInst::Create(Instruction::IntToPtr, statFunc, PointerType::getUnqual(statType), "stat", block);
- CallInst::Create(statPtr, {stateArg, stat}, "", block);
+ CallInst::Create(statType, statPtr, {stateArg, stat}, "", block);
BranchInst::Create(more, block);
}
@@ -521,7 +521,7 @@ public:
const auto clearFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TFlowState::Clear));
const auto clearType = FunctionType::get(Type::getInt1Ty(context), {stateArg->getType()}, false);
const auto clearPtr = CastInst::Create(Instruction::IntToPtr, clearFunc, PointerType::getUnqual(clearType), "clear", block);
- CallInst::Create(clearPtr, {stateArg}, "", block);
+ CallInst::Create(clearType, clearPtr, {stateArg}, "", block);
BranchInst::Create(more, block);
@@ -825,7 +825,7 @@ private:
const auto more = BasicBlock::Create(context, "more", ctx.Func);
auto block = main;
- const auto indexPtr = GetElementPtrInst::CreateInBounds(stateArg, { fieldsStruct.This(), fieldsStruct.GetIndex() }, "index_ptr", block);
+ const auto indexPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { fieldsStruct.This(), fieldsStruct.GetIndex() }, "index_ptr", block);
const auto itemPtr = new AllocaInst(valueType, 0U, "item_ptr", block);
new StoreInst(ConstantInt::get(valueType, 0), itemPtr, block);
@@ -834,7 +834,7 @@ private:
block = more;
- const auto index = new LoadInst(indexPtr, "index", block);
+ const auto index = new LoadInst(indexType, indexPtr, "index", block);
const auto empty = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, index, ConstantInt::get(index->getType(), Handlers.size()), "empty", block);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
@@ -852,9 +852,9 @@ private:
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
- const auto statusPtr = GetElementPtrInst::CreateInBounds(stateArg, { fieldsStruct.This(), fieldsStruct.GetStatus() }, "last", block);
+ const auto statusPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { fieldsStruct.This(), fieldsStruct.GetStatus() }, "last", block);
- const auto last = new LoadInst(statusPtr, "last", block);
+ const auto last = new LoadInst(statusType, statusPtr, "last", block);
const auto choise = SwitchInst::Create(last, pull, 2U, block);
choise->addCase(ConstantInt::get(statusType, static_cast<ui32>(NUdf::EFetchStatus::Yield)), rest);
@@ -872,7 +872,7 @@ private:
const auto used = GetMemoryUsed(MemLimit, ctx, block);
const auto stream = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
BranchInst::Create(loop, block);
@@ -890,7 +890,7 @@ private:
const auto addFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TValueBase::Add));
const auto addType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), itemPtr->getType()}, false);
const auto addPtr = CastInst::Create(Instruction::IntToPtr, addFunc, PointerType::getUnqual(addType), "add", block);
- CallInst::Create(addPtr, {stateArg, itemPtr}, "", block);
+ CallInst::Create(addType, addPtr, {stateArg, itemPtr}, "", block);
const auto check = CheckAdjustedMemLimit<TrackRss>(MemLimit, used, ctx, block);
BranchInst::Create(done, loop, check, block);
@@ -900,7 +900,7 @@ private:
const auto resetFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TValueBase::Reset));
const auto resetType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType()}, false);
const auto resetPtr = CastInst::Create(Instruction::IntToPtr, resetFunc, PointerType::getUnqual(resetType), "reset", block);
- CallInst::Create(resetPtr, {stateArg}, "", block);
+ CallInst::Create(resetType, resetPtr, {stateArg}, "", block);
BranchInst::Create(more, block);
}
@@ -918,7 +918,7 @@ private:
const auto nextFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TValueBase::Get));
const auto nextType = FunctionType::get(Type::getInt1Ty(context), {stateArg->getType(), valuePtr->getType()}, false);
const auto nextPtr = CastInst::Create(Instruction::IntToPtr, nextFunc, PointerType::getUnqual(nextType), "next", block);
- const auto has = CallInst::Create(nextPtr, {stateArg, valuePtr}, "has", block);
+ const auto has = CallInst::Create(nextType, nextPtr, {stateArg, valuePtr}, "has", block);
BranchInst::Create(good, more, has, block);
@@ -936,7 +936,7 @@ private:
choise->addCase(idx, var);
block = var;
- const auto output = new LoadInst(valuePtr, "output", block);
+ const auto output = new LoadInst(valueType, valuePtr, "output", block);
ValueRelease(Handlers[i].Kind, output, ctx, block);
const auto unpack = Handlers[i].IsOutputVariant ? GetVariantParts(output, ctx, block) : std::make_pair(ConstantInt::get(indexType, 0), output);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_take.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_take.cpp
index 1b6e9701b22..d47120a84bd 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_take.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_take.cpp
@@ -40,7 +40,7 @@ public:
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto main = BasicBlock::Create(context, "main", ctx.Func);
- const auto load = new LoadInst(statePtr, "load", block);
+ const auto load = new LoadInst(valueType, statePtr, "load", block);
const auto state = PHINode::Create(load->getType(), 2U, "state", main);
state->addIncoming(load, block);
@@ -49,7 +49,7 @@ public:
block = init;
GetNodeValue(statePtr, Count, ctx, block);
- const auto save = new LoadInst(statePtr, "save", block);
+ const auto save = new LoadInst(valueType, statePtr, "save", block);
state->addIncoming(save, block);
BranchInst::Create(main, block);
@@ -127,7 +127,7 @@ public:
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto main = BasicBlock::Create(context, "main", ctx.Func);
- const auto load = new LoadInst(statePtr, "load", block);
+ const auto load = new LoadInst(valueType, statePtr, "load", block);
const auto state = PHINode::Create(load->getType(), 2U, "state", main);
state->addIncoming(load, block);
@@ -136,7 +136,7 @@ public:
block = init;
GetNodeValue(statePtr, Count, ctx, block);
- const auto save = new LoadInst(statePtr, "save", block);
+ const auto save = new LoadInst(valueType, statePtr, "save", block);
state->addIncoming(save, block);
BranchInst::Create(main, block);
@@ -268,15 +268,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), builder->getType(), list->getType(), count->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto result = CallInst::Create(funcPtr, {factory, builder, list, count}, "result", block);
+ const auto result = CallInst::Create(funType, funcPtr, {factory, builder, list, count}, "result", block);
return result;
} else {
const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block);
new StoreInst(list, retPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), builder->getType(), retPtr->getType(), count->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, retPtr, builder, retPtr, count}, "", block);
- const auto result = new LoadInst(retPtr, "result", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, builder, retPtr, count}, "", block);
+ const auto result = new LoadInst(list->getType(), retPtr, "result", block);
return result;
}
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp
index 755797cd28c..717e396e1cf 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp
@@ -957,7 +957,7 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TSqueezeSetFlowWrapper<TSetAccumulator>::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
@@ -969,7 +969,7 @@ public:
const auto result = PHINode::Create(valueType, 3U, "result", over);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
@@ -997,7 +997,7 @@ public:
const auto insType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), keyArg->getType()}, false);
const auto insPtr = CastInst::Create(Instruction::IntToPtr, insert, PointerType::getUnqual(insType), "insert", block);
- CallInst::Create(insPtr, {stateArg, keyArg}, "", block);
+ CallInst::Create(insType, insPtr, {stateArg, keyArg}, "", block);
BranchInst::Create(more, block);
@@ -1008,15 +1008,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {stateArg->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
- const auto dict = CallInst::Create(funcPtr, {stateArg}, "dict", block);
+ const auto dict = CallInst::Create(funType, funcPtr, {stateArg}, "dict", block);
UnRefBoxed(state, ctx, block);
result->addIncoming(dict, block);
} else {
const auto ptr = new AllocaInst(valueType, 0U, "ptr", block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), ptr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
- CallInst::Create(funcPtr, {stateArg, ptr}, "", block);
- const auto dict = new LoadInst(ptr, "dict", block);
+ CallInst::Create(funType, funcPtr, {stateArg, ptr}, "", block);
+ const auto dict = new LoadInst(valueType, ptr, "dict", block);
UnRefBoxed(state, ctx, block);
result->addIncoming(dict, block);
}
@@ -1143,7 +1143,7 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TSqueezeSetWideWrapper<TSetAccumulator>::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
@@ -1155,7 +1155,7 @@ public:
const auto result = PHINode::Create(valueType, 3U, "result", over);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
@@ -1189,7 +1189,7 @@ public:
const auto insType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), keyArg->getType()}, false);
const auto insPtr = CastInst::Create(Instruction::IntToPtr, insert, PointerType::getUnqual(insType), "insert", block);
- CallInst::Create(insPtr, {stateArg, keyArg}, "", block);
+ CallInst::Create(insType, insPtr, {stateArg, keyArg}, "", block);
BranchInst::Create(more, block);
@@ -1200,15 +1200,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {stateArg->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
- const auto dict = CallInst::Create(funcPtr, {stateArg}, "dict", block);
+ const auto dict = CallInst::Create(funType, funcPtr, {stateArg}, "dict", block);
UnRefBoxed(state, ctx, block);
result->addIncoming(dict, block);
} else {
const auto ptr = new AllocaInst(valueType, 0U, "ptr", block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), ptr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
- CallInst::Create(funcPtr, {stateArg, ptr}, "", block);
- const auto dict = new LoadInst(ptr, "dict", block);
+ CallInst::Create(funType, funcPtr, {stateArg, ptr}, "", block);
+ const auto dict = new LoadInst(valueType, ptr, "dict", block);
UnRefBoxed(state, ctx, block);
result->addIncoming(dict, block);
}
@@ -1457,7 +1457,7 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TSqueezeMapFlowWrapper<TMapAccumulator>::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
@@ -1469,7 +1469,7 @@ public:
const auto result = PHINode::Create(valueType, 3U, "result", over);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
@@ -1499,7 +1499,7 @@ public:
const auto insType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), keyArg->getType(), payloadArg->getType()}, false);
const auto insPtr = CastInst::Create(Instruction::IntToPtr, insert, PointerType::getUnqual(insType), "insert", block);
- CallInst::Create(insPtr, {stateArg, keyArg, payloadArg}, "", block);
+ CallInst::Create(insType, insPtr, {stateArg, keyArg, payloadArg}, "", block);
BranchInst::Create(more, block);
@@ -1510,15 +1510,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {stateArg->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
- const auto dict = CallInst::Create(funcPtr, {stateArg}, "dict", block);
+ const auto dict = CallInst::Create(funType, funcPtr, {stateArg}, "dict", block);
UnRefBoxed(state, ctx, block);
result->addIncoming(dict, block);
} else {
const auto ptr = new AllocaInst(valueType, 0U, "ptr", block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), ptr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
- CallInst::Create(funcPtr, {stateArg, ptr}, "", block);
- const auto dict = new LoadInst(ptr, "dict", block);
+ CallInst::Create(funType, funcPtr, {stateArg, ptr}, "", block);
+ const auto dict = new LoadInst(valueType, ptr, "dict", block);
UnRefBoxed(state, ctx, block);
result->addIncoming(dict, block);
}
@@ -1652,7 +1652,7 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TSqueezeMapWideWrapper<TMapAccumulator>::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
@@ -1664,7 +1664,7 @@ public:
const auto result = PHINode::Create(valueType, 3U, "result", over);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
@@ -1700,7 +1700,7 @@ public:
const auto insType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), keyArg->getType(), payloadArg->getType()}, false);
const auto insPtr = CastInst::Create(Instruction::IntToPtr, insert, PointerType::getUnqual(insType), "insert", block);
- CallInst::Create(insPtr, {stateArg, keyArg, payloadArg}, "", block);
+ CallInst::Create(insType, insPtr, {stateArg, keyArg, payloadArg}, "", block);
BranchInst::Create(more, block);
@@ -1711,15 +1711,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(valueType, {stateArg->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
- const auto dict = CallInst::Create(funcPtr, {stateArg}, "dict", block);
+ const auto dict = CallInst::Create(funType, funcPtr, {stateArg}, "dict", block);
UnRefBoxed(state, ctx, block);
result->addIncoming(dict, block);
} else {
const auto ptr = new AllocaInst(valueType, 0U, "ptr", block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), ptr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, build, PointerType::getUnqual(funType), "build", block);
- CallInst::Create(funcPtr, {stateArg, ptr}, "", block);
- const auto dict = new LoadInst(ptr, "dict", block);
+ CallInst::Create(funType, funcPtr, {stateArg, ptr}, "", block);
+ const auto dict = new LoadInst(valueType, ptr, "dict", block);
UnRefBoxed(state, ctx, block);
result->addIncoming(dict, block);
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_toindexdict.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_toindexdict.cpp
index 5e78b4e1002..e6d4a9434fb 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_toindexdict.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_toindexdict.cpp
@@ -27,11 +27,12 @@ public:
const auto indexType = Type::getInt32Ty(context);
- const auto first = GetElementPtrInst::CreateInBounds(ctx.Ctx, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 0)}, "first", block);
- const auto fourth = GetElementPtrInst::CreateInBounds(ctx.Ctx, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 3)}, "fourth", block);
+ const auto first = GetElementPtrInst::CreateInBounds(GetCompContextType(context), ctx.Ctx, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 0)}, "first", block);
+ const auto fourth = GetElementPtrInst::CreateInBounds(GetCompContextType(context), ctx.Ctx, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, 3)}, "fourth", block);
- const auto factory = new LoadInst(first, "factory", block);
- const auto builder = new LoadInst(fourth, "builder", block);
+ const auto structPtrType = PointerType::getUnqual(StructType::get(context));
+ const auto factory = new LoadInst(structPtrType, first, "factory", block);
+ const auto builder = new LoadInst(structPtrType, fourth, "builder", block);
const auto func = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&THolderFactory::ToIndexDict));
@@ -40,15 +41,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType(), {factory->getType(), builder->getType(), list->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- const auto result = CallInst::Create(funcPtr, {factory, builder, list}, "result", block);
+ const auto result = CallInst::Create(funType, funcPtr, {factory, builder, list}, "result", block);
return result;
} else {
const auto retPtr = new AllocaInst(list->getType(), 0U, "ret_ptr", block);
new StoreInst(list, retPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {factory->getType(), retPtr->getType(), builder->getType(), retPtr->getType()}, false);
const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(funcPtr, {factory, retPtr, builder, retPtr}, "", block);
- const auto result = new LoadInst(retPtr, "result", block);
+ CallInst::Create(funType, funcPtr, {factory, retPtr, builder, retPtr}, "", block);
+ const auto result = new LoadInst(list->getType(), retPtr, "result", block);
return result;
}
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_tooptional.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_tooptional.cpp
index c41f8c6f0e8..56176251e51 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_tooptional.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_tooptional.cpp
@@ -58,7 +58,7 @@ public:
BranchInst::Create(many, none, test, block);
block = many;
- const auto item = new LoadInst(elements, "item", block);
+ const auto item = new LoadInst(valueType, elements, "item", block);
ValueAddRef(this->GetRepresentation(), item, ctx, block);
new StoreInst(IsOptional ? MakeOptional(context, item, block) : item, result, block);
BranchInst::Create(done, block);
@@ -68,7 +68,7 @@ public:
block = slow;
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListIterator>(result, list, ctx.Codegen, block);
- const auto iter = new LoadInst(result, "iter", block);
+ const auto iter = new LoadInst(valueType, result, "iter", block);
new StoreInst(ConstantInt::get(valueType, 0ULL), result, block);
const auto status = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::Next>(Type::getInt1Ty(context), iter, ctx.Codegen, block, result);
@@ -76,10 +76,10 @@ public:
BranchInst::Create(good, none, status, block);
- if (IsOptional) {
+ if constexpr (IsOptional) {
block = good;
- const auto item = new LoadInst(result, "item", block);
+ const auto item = new LoadInst(valueType, result, "item", block);
new StoreInst(MakeOptional(context, item, block), result, block);
BranchInst::Create(done, block);
}
@@ -157,8 +157,8 @@ public:
block = many;
const auto index = BinaryOperator::CreateSub(size, ConstantInt::get(size->getType(), 1), "index", block);
- const auto last = GetElementPtrInst::CreateInBounds(elements, {index}, "last", block);
- const auto item = new LoadInst(last, "item", block);
+ const auto last = GetElementPtrInst::CreateInBounds(valueType, elements, {index}, "last", block);
+ const auto item = new LoadInst(valueType, last, "item", block);
ValueAddRef(this->GetRepresentation(), item, ctx, block);
new StoreInst(IsOptional ? MakeOptional(context, item, block) : item, result, block);
BranchInst::Create(done, block);
@@ -168,7 +168,7 @@ public:
block = slow;
CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::GetListIterator>(result, list, ctx.Codegen, block);
- const auto iter = new LoadInst(result, "iter", block);
+ const auto iter = new LoadInst(valueType, result, "iter", block);
new StoreInst(ConstantInt::get(valueType, 0ULL), result, block);
const auto first = CallBoxedValueVirtualMethod<NUdf::TBoxedValueAccessor::EMethod::Next>(Type::getInt1Ty(context), iter, ctx.Codegen, block, result);
@@ -188,8 +188,8 @@ public:
UnRefBoxed(iter, ctx, block);
- if (IsOptional) {
- const auto item = new LoadInst(result, "item", block);
+ if constexpr (IsOptional) {
+ const auto item = new LoadInst(valueType, result, "item", block);
new StoreInst(MakeOptional(context, item, block), result, block);
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_tostring.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_tostring.cpp
index 66e6c73c872..c4426925864 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_tostring.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_tostring.cpp
@@ -65,14 +65,10 @@ public:
const auto name = "DecimalToString";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DecimalToString));
- llvm::Value* func;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
- const auto fnType = FunctionType::get(valType, { valType, psType, psType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- } else {
- const auto fnType = FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, psType, psType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- }
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ FunctionType::get(valType, { valType, psType, psType }, false):
+ FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, psType, psType }, false);
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
const auto fail = BasicBlock::Create(context, "fail", ctx.Func);
const auto nice = BasicBlock::Create(context, "nice", ctx.Func);
@@ -83,7 +79,7 @@ public:
const auto value = GetNodeValue(Data, ctx, block);
Value* result;
- if (IsOptional) {
+ if constexpr (IsOptional) {
const auto call = BasicBlock::Create(context, "call", ctx.Func);
const auto res = PHINode::Create(valType, 2, "result", nice);
res->addIncoming(zero, block);
@@ -101,7 +97,7 @@ public:
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
new StoreInst(GetterForInt128(value, block), retPtr, block);
CallInst::Create(func, { retPtr, retPtr, precision, scale }, "", block);
- string = new LoadInst(retPtr, "res", block);
+ string = new LoadInst(valType, retPtr, "res", block);
}
res->addIncoming(string, block);
@@ -115,7 +111,7 @@ public:
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
new StoreInst(GetterForInt128(value, block), retPtr, block);
CallInst::Create(func, { retPtr, retPtr, precision, scale }, "", block);
- result = new LoadInst(retPtr, "res", block);
+ result = new LoadInst(valType, retPtr, "res", block);
}
const auto test = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, result, zero, "test", block);
@@ -124,8 +120,9 @@ public:
block = fail;
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TDecimalToStringWrapper::Throw));
- const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(FunctionType::get(Type::getVoidTy(context), {}, false)), "thrower", block);
- CallInst::Create(doFuncPtr, {}, "", block);
+ const auto doFuncType = FunctionType::get(Type::getVoidTy(context), {}, false);
+ const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(doFuncType), "thrower", block);
+ CallInst::Create(doFuncType, doFuncPtr, {}, "", block);
new UnreachableInst(context, block);
block = nice;
@@ -174,20 +171,16 @@ public:
const auto name = "DataToString";
ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(&DataToString));
- llvm::Value* func;
- if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
- const auto fnType = FunctionType::get(valType, { valType, slotType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- } else {
- const auto fnType = FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, slotType }, false);
- func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType).getCallee();
- }
+ const auto fnType = NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget() ?
+ FunctionType::get(valType, { valType, slotType }, false):
+ FunctionType::get(Type::getVoidTy(context), { valTypePtr, valTypePtr, slotType }, false);
+ const auto func = ctx.Codegen->GetModule().getOrInsertFunction(name, fnType);
const auto zero = ConstantInt::get(valType, 0ULL);
const auto slot = ConstantInt::get(slotType, static_cast<ui32>(SchemeType));
const auto value = GetNodeValue(Data, ctx, block);
- if (IsOptional) {
+ if constexpr (IsOptional) {
const auto done = BasicBlock::Create(context, "done", ctx.Func);
const auto call = BasicBlock::Create(context, "call", ctx.Func);
const auto result = PHINode::Create(valType, 2, "result", done);
@@ -205,7 +198,7 @@ public:
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
new StoreInst(value, retPtr, block);
CallInst::Create(func, { retPtr, retPtr, slot }, "", block);
- string = new LoadInst(retPtr, "res", block);
+ string = new LoadInst(valType, retPtr, "res", block);
}
if (Data->IsTemporaryValue())
@@ -224,7 +217,7 @@ public:
const auto retPtr = new AllocaInst(valType, 0U, "ret_ptr", block);
new StoreInst(value, retPtr, block);
CallInst::Create(func, { retPtr, retPtr, slot}, "", block);
- string = new LoadInst(retPtr, "res", block);
+ string = new LoadInst(valType, retPtr, "res", block);
}
if (Data->IsTemporaryValue())
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp
index 893cb08456e..19d27eac7c7 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp
@@ -40,7 +40,7 @@ public:
const auto builder = ctx.GetBuilder();
const auto funType = FunctionType::get(Type::getVoidTy(context), {boxed->getType(), result->getType(), builder->getType(), args->getType()}, false);
- const auto runFunc = ctx.Codegen->GetModule().getOrInsertFunction(llvm::StringRef(FunctionName.data(), FunctionName.size()), funType).getCallee();
+ const auto runFunc = ctx.Codegen->GetModule().getOrInsertFunction(llvm::StringRef(FunctionName.data(), FunctionName.size()), funType);
CallInst::Create(runFunc, {boxed, result, builder, args}, "", block);
}
#endif
@@ -79,8 +79,10 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
void DoGenerateGetValue(const TCodegenContext& ctx, Value* pointer, BasicBlock*& block) const {
+ auto& context = ctx.Codegen->GetContext();
+
GetNodeValue(pointer, RunConfigNode, ctx, block);
- const auto conf = new LoadInst(pointer, "conf", block);
+ const auto conf = new LoadInst(Type::getInt128Ty(context), pointer, "conf", block);
const auto func = GetNodeValue(FunctionImpl, ctx, block);
@@ -88,14 +90,12 @@ public:
ValueUnRef(RunConfigNode->GetRepresentation(), conf, ctx, block);
- auto& context = ctx.Codegen->GetContext();
-
const auto ptrType = PointerType::getUnqual(StructType::get(context));
const auto wrap = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TUdfWrapper::Wrap));
const auto self = CastInst::Create(Instruction::IntToPtr, ConstantInt::get(Type::getInt64Ty(context), uintptr_t(this)), ptrType, "self", block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), pointer->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, wrap, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(doFuncPtr, {self, pointer}, "", block);
+ CallInst::Create(funType, doFuncPtr, {self, pointer}, "", block);
}
#endif
private:
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp
index daef4d28f90..15ed4a0df1d 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp
@@ -30,7 +30,6 @@ public:
#ifndef MKQL_DISABLE_CODEGEN
Value* DoGenerateGetValue(const TCodegenContext& ctx, Value* value, BasicBlock*& block) const {
auto& context = ctx.Codegen->GetContext();
- const auto valueType = Type::getInt128Ty(context);
const auto kill = BasicBlock::Create(context, "kill", ctx.Func);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
@@ -40,8 +39,9 @@ public:
block = kill;
const auto doFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TUnwrapWrapper::Throw));
const auto doFuncArg = ConstantInt::get(Type::getInt64Ty(context), (ui64)this);
- const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(FunctionType::get(Type::getVoidTy(context), { Type::getInt64Ty(context), ctx.Ctx->getType() }, false)), "thrower", block);
- CallInst::Create(doFuncPtr, { doFuncArg, ctx.Ctx }, "", block)->setTailCall();
+ const auto doFuncType = FunctionType::get(Type::getVoidTy(context), { Type::getInt64Ty(context), ctx.Ctx->getType() }, false);
+ const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(doFuncType), "thrower", block);
+ CallInst::Create(doFuncType, doFuncPtr, { doFuncArg, ctx.Ctx }, "", block)->setTailCall();
new UnreachableInst(context, block);
block = good;
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_visitall.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_visitall.cpp
index 76adbc982b9..767ef11dfc6 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_visitall.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_visitall.cpp
@@ -101,7 +101,8 @@ public:
const auto work = BasicBlock::Create(context, "work", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
- const auto result = PHINode::Create(Type::getInt128Ty(context), NewNodes.size() + 2U, "result", done);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto result = PHINode::Create(valueType, NewNodes.size() + 2U, "result", done);
BranchInst::Create(init, work, IsInvalid(statePtr, block), block);
@@ -130,7 +131,7 @@ public:
{
block = work;
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto index = GetterFor<ui32>(state, context, block);
result->addIncoming(GetFinish(context), block);
const auto choise = SwitchInst::Create(index, done, NewNodes.size(), block);
@@ -228,7 +229,7 @@ public:
{
block = work;
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(Type::getInt128Ty(context), statePtr, "state", block);
const auto index = GetterFor<ui32>(state, context, block);
result->addIncoming(ConstantInt::get(resultType, static_cast<i32>(EFetchResult::Finish)), block);
const auto choise = SwitchInst::Create(index, done, NewNodes.size(), block);
@@ -260,10 +261,11 @@ public:
const auto done = BasicBlock::Create(context, "done", ctx.Func);
new UnreachableInst(context, stub);
- const auto res = PHINode::Create(Type::getInt128Ty(context), slice.size(), "res", done);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto res = PHINode::Create(valueType, slice.size(), "res", done);
- const auto statePtr = GetElementPtrInst::CreateInBounds(ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), index)}, "state_ptr", block);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto statePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), index)}, "state_ptr", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto trunc = GetterFor<ui32>(state, context, block);
const auto choise = SwitchInst::Create(trunc, stub, slice.size(), block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_while.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_while.cpp
index a8650d57540..ad13b194aaa 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_while.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_while.cpp
@@ -62,7 +62,7 @@ public:
const auto result = PHINode::Create(valueType, SkipOrTake ? 3U : 4U, "result", done);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto finished = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, state, GetTrue(context), "finished", block);
BranchInst::Create(skip, work, finished, block);
@@ -334,7 +334,7 @@ protected:
auto block = main;
const auto container = codegen->GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows ?
- new LoadInst(containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
+ new LoadInst(valueType, containerArg, "load_container", false, block) : static_cast<Value*>(containerArg);
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto stop = BasicBlock::Create(context, "stop", ctx.Func);
@@ -358,7 +358,7 @@ protected:
BranchInst::Create(good, done, icmp, block);
block = good;
- const auto item = new LoadInst(itemPtr, "item", block);
+ const auto item = new LoadInst(valueType, itemPtr, "item", block);
const auto predicate = GetNodeValue(Predicate, ctx, block);
const auto boolPred = CastInst::Create(Instruction::Trunc, predicate, Type::getInt1Ty(context), "bool", block);
@@ -537,14 +537,14 @@ public:
block = loop;
- const auto ptr = GetElementPtrInst::CreateInBounds(elements, {index}, "ptr", block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(list->getType(), elements, {index}, "ptr", block);
const auto plus = BinaryOperator::CreateAdd(index, ConstantInt::get(size->getType(), 1), "plus", block);
const auto more = CmpInst::Create(Instruction::ICmp, Inclusive ? ICmpInst::ICMP_ULT : ICmpInst::ICMP_ULE, plus, size, "more", block);
BranchInst::Create(test, stop, more, block);
block = test;
- const auto item = new LoadInst(ptr, "item", block);
+ const auto item = new LoadInst(list->getType(), ptr, "item", block);
codegenItem->CreateSetValue(ctx, block, item);
const auto predicate = GetNodeValue(this->Predicate, ctx, block);
const auto boolPred = CastInst::Create(Instruction::Trunc, predicate, Type::getInt1Ty(context), "bool", block);
@@ -562,12 +562,13 @@ public:
block = make;
+ const auto itemsType = PointerType::getUnqual(list->getType());
const auto itemsPtr = *this->Stateless || ctx.AlwaysInline ?
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
- new AllocaInst(PointerType::getUnqual(list->getType()), 0U, "items_ptr", block);
+ new AllocaInst(itemsType, 0U, "items_ptr", &ctx.Func->getEntryBlock().back()):
+ new AllocaInst(itemsType, 0U, "items_ptr", block);
const auto array = GenNewArray(ctx, copy, itemsPtr, block);
- const auto items = new LoadInst(itemsPtr, "items", block);
- const auto from = SkipOrTake ? GetElementPtrInst::CreateInBounds(elements, {pass}, "from", block) : elements;
+ const auto items = new LoadInst(itemsType, itemsPtr, "items", block);
+ const auto from = SkipOrTake ? GetElementPtrInst::CreateInBounds(list->getType(), elements, {pass}, "from", block) : elements;
const auto move = BasicBlock::Create(context, "move", ctx.Func);
const auto step = BasicBlock::Create(context, "step", ctx.Func);
@@ -584,10 +585,10 @@ public:
block = step;
- const auto src = GetElementPtrInst::CreateInBounds(from, {idx}, "src", block);
- const auto itm = new LoadInst(src, "item", block);
+ const auto src = GetElementPtrInst::CreateInBounds(list->getType(), from, {idx}, "src", block);
+ const auto itm = new LoadInst(list->getType(), src, "item", block);
ValueAddRef(this->Item->GetRepresentation(), itm, ctx, block);
- const auto dst = GetElementPtrInst::CreateInBounds(items, {idx}, "dst", block);
+ const auto dst = GetElementPtrInst::CreateInBounds(list->getType(), items, {idx}, "dst", block);
new StoreInst(itm, dst, block);
const auto inc = BinaryOperator::CreateAdd(idx, ConstantInt::get(idx->getType(), 1), "inc", block);
idx->addIncoming(inc, block);
@@ -610,15 +611,15 @@ public:
if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) {
const auto funType = FunctionType::get(list->getType() , {self->getType(), ctx.Ctx->getType(), list->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- const auto value = CallInst::Create(doFuncPtr, {self, ctx.Ctx, list}, "value", block);
+ const auto value = CallInst::Create(funType, doFuncPtr, {self, ctx.Ctx, list}, "value", block);
out->addIncoming(value, block);
} else {
const auto resultPtr = new AllocaInst(list->getType(), 0U, "return", block);
new StoreInst(list, resultPtr, block);
const auto funType = FunctionType::get(Type::getVoidTy(context), {self->getType(), resultPtr->getType(), ctx.Ctx->getType(), resultPtr->getType()}, false);
const auto doFuncPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "function", block);
- CallInst::Create(doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
- const auto value = new LoadInst(resultPtr, "value", block);
+ CallInst::Create(funType, doFuncPtr, {self, resultPtr, ctx.Ctx, resultPtr}, "", block);
+ const auto value = new LoadInst(list->getType(), resultPtr, "value", block);
out->addIncoming(value, block);
}
BranchInst::Create(done, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_chain_map.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_chain_map.cpp
index 5c5e5a4bd85..2c22c098592 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_chain_map.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_chain_map.cpp
@@ -48,7 +48,8 @@ public:
ICodegeneratorInlineWideNode::TGenerateResult DoGenGetValues(const TCodegenContext& ctx, Value* statePtr, BasicBlock*& block) const {
auto& context = ctx.Codegen->GetContext();
- const auto flagPtr = new AllocaInst(Type::getInt1Ty(context), 0U, "flag_ptr", &ctx.Func->getEntryBlock().back());
+ const auto flagType = Type::getInt1Ty(context);
+ const auto flagPtr = new AllocaInst(flagType, 0U, "flag_ptr", &ctx.Func->getEntryBlock().back());
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
@@ -108,7 +109,7 @@ public:
else if (Outputs[i]->GetDependencesCount() > 0 || OutputsOnUpdate[i])
result.emplace_back([output = Outputs[i]] (const TCodegenContext& ctx, BasicBlock*& block) { return GetNodeValue(output, ctx, block); });
else
- result.emplace_back([this, i, source = getres.second, flagPtr] (const TCodegenContext& ctx, BasicBlock*& block) {
+ result.emplace_back([this, i, source = getres.second, flagPtr, flagType] (const TCodegenContext& ctx, BasicBlock*& block) {
auto& context = ctx.Codegen->GetContext();
const auto init = BasicBlock::Create(context, "init", ctx.Func);
@@ -117,7 +118,7 @@ public:
const auto result = PHINode::Create(Type::getInt128Ty(context), 2U, "result", done);
- const auto flag = new LoadInst(flagPtr, "flag", block);
+ const auto flag = new LoadInst(flagType, flagPtr, "flag", block);
BranchInst::Create(init, next, flag, block);
block = init;
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_chopper.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_chopper.cpp
index e06568fa321..3b142e56a84 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_chopper.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_chopper.cpp
@@ -138,8 +138,9 @@ private:
const auto resultType = Type::getInt32Ty(context);
const auto result = PHINode::Create(resultType, 4U, "result", done);
- const auto statePtr = GetElementPtrInst::CreateInBounds(ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), static_cast<const IComputationNode*>(this)->GetIndex())}, "state_ptr", block);
- const auto entry = new LoadInst(statePtr, "entry", block);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto statePtr = GetElementPtrInst::CreateInBounds(valueType, ctx.GetMutables(), {ConstantInt::get(Type::getInt32Ty(context), static_cast<const IComputationNode*>(this)->GetIndex())}, "state_ptr", block);
+ const auto entry = new LoadInst(valueType, statePtr, "entry", block);
const auto next = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, entry, GetConstant(ui64(EState::Next), context), "next", block);
BranchInst::Create(load, work, next, block);
@@ -202,7 +203,8 @@ public:
const auto resultType = Type::getInt32Ty(context);
const auto result = PHINode::Create(resultType, 5U, "result", exit);
- const auto first = new LoadInst(statePtr, "first", block);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto first = new LoadInst(valueType, statePtr, "first", block);
const auto enter = SwitchInst::Create(first, loop, 2U, block);
enter->addCase(GetInvalid(context), init);
enter->addCase(GetConstant(ui64(EState::Skip), context), pass);
@@ -246,7 +248,7 @@ public:
block = loop;
auto getres = GetNodeValues(Output, ctx, block);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto finish = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_SLT, getres.first, ConstantInt::get(getres.first->getType(), 0), "finish", block);
result->addIncoming(getres.first, block);
BranchInst::Create(part, exit, finish, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_combine.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_combine.cpp
index 16b86f90739..6cf1ec54998 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_combine.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_combine.cpp
@@ -414,12 +414,12 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TWideCombinerWrapper::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
BranchInst::Create(more, block);
@@ -432,7 +432,7 @@ public:
const auto isEmptyFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::IsEmpty));
const auto isEmptyFuncType = FunctionType::get(Type::getInt1Ty(context), { statePtrType }, false);
const auto isEmptyFuncPtr = CastInst::Create(Instruction::IntToPtr, isEmptyFunc, PointerType::getUnqual(isEmptyFuncType), "empty_func", block);
- const auto empty = CallInst::Create(isEmptyFuncPtr, { stateArg }, "empty", block);
+ const auto empty = CallInst::Create(isEmptyFuncType, isEmptyFuncPtr, { stateArg }, "empty", block);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
const auto full = BasicBlock::Create(context, "full", ctx.Func);
@@ -448,9 +448,9 @@ public:
const auto good = BasicBlock::Create(context, "good", ctx.Func);
const auto done = BasicBlock::Create(context, "done", ctx.Func);
- const auto statusPtr = GetElementPtrInst::CreateInBounds(stateArg, { stateFields.This(), stateFields.GetStatus() }, "last", block);
+ const auto statusPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { stateFields.This(), stateFields.GetStatus() }, "last", block);
- const auto last = new LoadInst(statusPtr, "last", block);
+ const auto last = new LoadInst(statusType, statusPtr, "last", block);
result->addIncoming(last, block);
@@ -489,13 +489,13 @@ public:
items[i] = getres.second[i](ctx, block);
}
- const auto tonguePtr = GetElementPtrInst::CreateInBounds(stateArg, { stateFields.This(), stateFields.GetTongue() }, "tongue_ptr", block);
- const auto tongue = new LoadInst(tonguePtr, "tongue", block);
+ const auto tonguePtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { stateFields.This(), stateFields.GetTongue() }, "tongue_ptr", block);
+ const auto tongue = new LoadInst(ptrValueType, tonguePtr, "tongue", block);
std::vector<Value*> keyPointers(Nodes.KeyResultNodes.size(), nullptr), keys(Nodes.KeyResultNodes.size(), nullptr);
for (ui32 i = 0U; i < Nodes.KeyResultNodes.size(); ++i) {
auto& key = keys[i];
- const auto keyPtr = keyPointers[i] = GetElementPtrInst::CreateInBounds(tongue, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("key_") += ToString(i)).c_str(), block);
+ const auto keyPtr = keyPointers[i] = GetElementPtrInst::CreateInBounds(valueType, tongue, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("key_") += ToString(i)).c_str(), block);
if (const auto map = Nodes.KeysOnItems[i]) {
auto& it = items[*map];
if (!it)
@@ -514,19 +514,19 @@ public:
const auto atFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::TasteIt));
const auto atType = FunctionType::get(Type::getInt1Ty(context), {stateArg->getType()}, false);
const auto atPtr = CastInst::Create(Instruction::IntToPtr, atFunc, PointerType::getUnqual(atType), "function", block);
- const auto newKey = CallInst::Create(atPtr, {stateArg}, "new_key", block);
+ const auto newKey = CallInst::Create(atType, atPtr, {stateArg}, "new_key", block);
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
const auto test = BasicBlock::Create(context, "test", ctx.Func);
- const auto throatPtr = GetElementPtrInst::CreateInBounds(stateArg, { stateFields.This(), stateFields.GetThroat() }, "throat_ptr", block);
- const auto throat = new LoadInst(throatPtr, "throat", block);
+ const auto throatPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { stateFields.This(), stateFields.GetThroat() }, "throat_ptr", block);
+ const auto throat = new LoadInst(ptrValueType, throatPtr, "throat", block);
std::vector<Value*> pointers;
pointers.reserve(Nodes.StateNodes.size());
for (ui32 i = 0U; i < Nodes.StateNodes.size(); ++i) {
- pointers.emplace_back(GetElementPtrInst::CreateInBounds(throat, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("state_") += ToString(i)).c_str(), block));
+ pointers.emplace_back(GetElementPtrInst::CreateInBounds(valueType, throat, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("state_") += ToString(i)).c_str(), block));
}
BranchInst::Create(init, next, newKey, block);
@@ -562,7 +562,7 @@ public:
const bool hasDependency = Nodes.StateNodes[i]->GetDependencesCount() > 0U;
if (const auto map = Nodes.StateOnUpdate[i]) {
if (hasDependency || i != *map) {
- stored[i] = new LoadInst(pointers[i], (TString("state_") += ToString(i)).c_str(), block);
+ stored[i] = new LoadInst(valueType, pointers[i], (TString("state_") += ToString(i)).c_str(), block);
if (hasDependency)
EnsureDynamicCast<ICodegeneratorExternalNode*>(Nodes.StateNodes[i])->CreateSetValue(ctx, block, stored[i]);
}
@@ -578,7 +578,7 @@ public:
if (const auto j = *map; i != j) {
auto& it = stored[j];
if (!it)
- it = new LoadInst(pointers[j], (TString("state_") += ToString(j)).c_str(), block);
+ it = new LoadInst(valueType, pointers[j], (TString("state_") += ToString(j)).c_str(), block);
new StoreInst(it, pointers[i], block);
if (i != *Nodes.StateOnUpdate[j])
ValueAddRef(Nodes.UpdateResultNodes[i]->GetRepresentation(), it, ctx, block);
@@ -613,7 +613,7 @@ public:
const auto statFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::PushStat));
const auto statType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType(), stat->getType()}, false);
const auto statPtr = CastInst::Create(Instruction::IntToPtr, statFunc, PointerType::getUnqual(statType), "stat", block);
- CallInst::Create(statPtr, {stateArg, stat}, "", block);
+ CallInst::Create(statType, statPtr, {stateArg, stat}, "", block);
BranchInst::Create(full, block);
}
@@ -626,7 +626,7 @@ public:
const auto extractFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Extract));
const auto extractType = FunctionType::get(ptrValueType, {stateArg->getType()}, false);
const auto extractPtr = CastInst::Create(Instruction::IntToPtr, extractFunc, PointerType::getUnqual(extractType), "extract", block);
- const auto out = CallInst::Create(extractPtr, {stateArg}, "out", block);
+ const auto out = CallInst::Create(extractType, extractPtr, {stateArg}, "out", block);
const auto has = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, out, ConstantPointerNull::get(ptrValueType), "has", block);
BranchInst::Create(good, more, has, block);
@@ -634,7 +634,7 @@ public:
block = good;
for (ui32 i = 0U; i < Nodes.FinishNodes.size(); ++i) {
- const auto ptr = GetElementPtrInst::CreateInBounds(out, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("out_key_") += ToString(i)).c_str(), block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(valueType, out, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("out_key_") += ToString(i)).c_str(), block);
if (Nodes.FinishNodes[i]->GetDependencesCount() > 0 || Nodes.ItemsOnResult[i])
EnsureDynamicCast<ICodegeneratorExternalNode*>(Nodes.FinishNodes[i])->CreateSetValue(ctx, block, ptr);
else
@@ -789,12 +789,12 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TWideLastCombinerWrapper::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
BranchInst::Create(more, block);
@@ -806,8 +806,8 @@ public:
const auto over = BasicBlock::Create(context, "over", ctx.Func);
const auto result = PHINode::Create(statusType, 3U, "result", over);
- const auto statusPtr = GetElementPtrInst::CreateInBounds(stateArg, { stateFields.This(), stateFields.GetStatus() }, "last", block);
- const auto last = new LoadInst(statusPtr, "last", block);
+ const auto statusPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { stateFields.This(), stateFields.GetStatus() }, "last", block);
+ const auto last = new LoadInst(statusType, statusPtr, "last", block);
const auto finish = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, last, ConstantInt::get(last->getType(), static_cast<i32>(EFetchResult::Finish)), "finish", block);
BranchInst::Create(full, loop, finish, block);
@@ -841,13 +841,13 @@ public:
items[i] = getres.second[i](ctx, block);
}
- const auto tonguePtr = GetElementPtrInst::CreateInBounds(stateArg, { stateFields.This(), stateFields.GetTongue() }, "tongue_ptr", block);
- const auto tongue = new LoadInst(tonguePtr, "tongue", block);
+ const auto tonguePtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { stateFields.This(), stateFields.GetTongue() }, "tongue_ptr", block);
+ const auto tongue = new LoadInst(ptrValueType, tonguePtr, "tongue", block);
std::vector<Value*> keyPointers(Nodes.KeyResultNodes.size(), nullptr), keys(Nodes.KeyResultNodes.size(), nullptr);
for (ui32 i = 0U; i < Nodes.KeyResultNodes.size(); ++i) {
auto& key = keys[i];
- const auto keyPtr = keyPointers[i] = GetElementPtrInst::CreateInBounds(tongue, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("key_") += ToString(i)).c_str(), block);
+ const auto keyPtr = keyPointers[i] = GetElementPtrInst::CreateInBounds(valueType, tongue, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("key_") += ToString(i)).c_str(), block);
if (const auto map = Nodes.KeysOnItems[i]) {
auto& it = items[*map];
if (!it)
@@ -866,18 +866,18 @@ public:
const auto atFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::TasteIt));
const auto atType = FunctionType::get(Type::getInt1Ty(context), {stateArg->getType()}, false);
const auto atPtr = CastInst::Create(Instruction::IntToPtr, atFunc, PointerType::getUnqual(atType), "function", block);
- const auto newKey = CallInst::Create(atPtr, {stateArg}, "new_key", block);
+ const auto newKey = CallInst::Create(atType, atPtr, {stateArg}, "new_key", block);
const auto init = BasicBlock::Create(context, "init", ctx.Func);
const auto next = BasicBlock::Create(context, "next", ctx.Func);
- const auto throatPtr = GetElementPtrInst::CreateInBounds(stateArg, { stateFields.This(), stateFields.GetThroat() }, "throat_ptr", block);
- const auto throat = new LoadInst(throatPtr, "throat", block);
+ const auto throatPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { stateFields.This(), stateFields.GetThroat() }, "throat_ptr", block);
+ const auto throat = new LoadInst(ptrValueType, throatPtr, "throat", block);
std::vector<Value*> pointers;
pointers.reserve(Nodes.StateNodes.size());
for (ui32 i = 0U; i < Nodes.StateNodes.size(); ++i) {
- pointers.emplace_back(GetElementPtrInst::CreateInBounds(throat, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("state_") += ToString(i)).c_str(), block));
+ pointers.emplace_back(GetElementPtrInst::CreateInBounds(valueType, throat, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("state_") += ToString(i)).c_str(), block));
}
BranchInst::Create(init, next, newKey, block);
@@ -913,7 +913,7 @@ public:
const bool hasDependency = Nodes.StateNodes[i]->GetDependencesCount() > 0U;
if (const auto map = Nodes.StateOnUpdate[i]) {
if (hasDependency || i != *map) {
- stored[i] = new LoadInst(pointers[i], (TString("state_") += ToString(i)).c_str(), block);
+ stored[i] = new LoadInst(valueType, pointers[i], (TString("state_") += ToString(i)).c_str(), block);
if (hasDependency)
EnsureDynamicCast<ICodegeneratorExternalNode*>(Nodes.StateNodes[i])->CreateSetValue(ctx, block, stored[i]);
}
@@ -929,7 +929,7 @@ public:
if (const auto j = *map; i != j) {
auto& it = stored[j];
if (!it)
- it = new LoadInst(pointers[j], (TString("state_") += ToString(j)).c_str(), block);
+ it = new LoadInst(valueType, pointers[j], (TString("state_") += ToString(j)).c_str(), block);
new StoreInst(it, pointers[i], block);
if (i != *Nodes.StateOnUpdate[j])
ValueAddRef(Nodes.UpdateResultNodes[i]->GetRepresentation(), it, ctx, block);
@@ -960,7 +960,7 @@ public:
const auto extractFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Extract));
const auto extractType = FunctionType::get(ptrValueType, {stateArg->getType()}, false);
const auto extractPtr = CastInst::Create(Instruction::IntToPtr, extractFunc, PointerType::getUnqual(extractType), "extract", block);
- const auto out = CallInst::Create(extractPtr, {stateArg}, "out", block);
+ const auto out = CallInst::Create(extractType, extractPtr, {stateArg}, "out", block);
const auto has = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, out, ConstantPointerNull::get(ptrValueType), "has", block);
result->addIncoming(ConstantInt::get(statusType, static_cast<i32>(EFetchResult::Finish)), block);
@@ -970,7 +970,7 @@ public:
block = good;
for (ui32 i = 0U; i < Nodes.FinishNodes.size(); ++i) {
- const auto ptr = GetElementPtrInst::CreateInBounds(out, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("out_key_") += ToString(i)).c_str(), block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(valueType, out, {ConstantInt::get(Type::getInt32Ty(context), i)}, (TString("out_key_") += ToString(i)).c_str(), block);
if (Nodes.FinishNodes[i]->GetDependencesCount() > 0 || Nodes.ItemsOnResult[i])
EnsureDynamicCast<ICodegeneratorExternalNode*>(Nodes.FinishNodes[i])->CreateSetValue(ctx, block, ptr);
else
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_condense.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_condense.cpp
index b8a1ff2ed67..22eac4ba390 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_condense.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_condense.cpp
@@ -115,7 +115,8 @@ public:
const auto stop = BasicBlock::Create(context, "stop", ctx.Func);
const auto exit = BasicBlock::Create(context, "exit", ctx.Func);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto valueType = Type::getInt128Ty(context);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto resultType = Type::getInt32Ty(context);
const auto result = PHINode::Create(resultType, 4U, "result", exit);
result->addIncoming(ConstantInt::get(resultType, i32(EFetchResult::Finish)), block);
@@ -134,7 +135,7 @@ public:
const auto cleanup = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&CleanupCurrentContext));
const auto cleanupType = FunctionType::get(Type::getVoidTy(context), {}, false);
const auto cleanupPtr = CastInst::Create(Instruction::IntToPtr, cleanup, PointerType::getUnqual(cleanupType), "cleanup_ctx", block);
- CallInst::Create(cleanupPtr, {}, "", block);
+ CallInst::Create(cleanupType, cleanupPtr, {}, "", block);
}
new StoreInst(GetFalse(context), statePtr, block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_filter.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_filter.cpp
index a4d4606bc52..76e1324d8c7 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_filter.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_filter.cpp
@@ -191,7 +191,7 @@ public:
block = test;
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto done = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, state, GetFalse(context), "done", block);
result->addIncoming(ConstantInt::get(resultType, -1), block);
@@ -284,7 +284,7 @@ public:
const auto result = PHINode::Create(resultType, 4U, "result", done);
result->addIncoming(ConstantInt::get(resultType, static_cast<i32>(EFetchResult::Finish)), block);
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(Type::getInt128Ty(context), statePtr, "state", block);
const auto finished = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, state, GetTrue(context), "finished", block);
BranchInst::Create(done, work, IsValid(statePtr, block), block);
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_wide_top_sort.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_wide_top_sort.cpp
index 8e361e4bcd0..551b98a9a7a 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_wide_top_sort.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_wide_top_sort.cpp
@@ -328,16 +328,17 @@ public:
const auto statePtrType = PointerType::getUnqual(stateType);
- const auto outputPtrType = PointerType::getUnqual(ArrayType::get(valueType, Representations.size()));
+ const auto outputType = ArrayType::get(valueType, Representations.size());
+ const auto outputPtrType = PointerType::getUnqual(outputType);
const auto outs = new AllocaInst(outputPtrType, 0U, "outs", &ctx.Func->getEntryBlock().back());
ICodegeneratorInlineWideNode::TGettersList getters(Representations.size());
for (auto i = 0U; i < getters.size(); ++i) {
- getters[Indexes[i]] = [i, outs, indexType](const TCodegenContext& ctx, BasicBlock*& block) {
- const auto values = new LoadInst(outs, "values", block);
- const auto pointer = GetElementPtrInst::CreateInBounds(values, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, (TString("ptr_") += ToString(i)).c_str(), block);
- return new LoadInst(pointer, (TString("load_") += ToString(i)).c_str(), block);
+ getters[Indexes[i]] = [i, outs, indexType, valueType, outputPtrType, outputType](const TCodegenContext& ctx, BasicBlock*& block) {
+ const auto values = new LoadInst(outputPtrType, outs, "values", block);
+ const auto pointer = GetElementPtrInst::CreateInBounds(outputType, values, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, (TString("ptr_") += ToString(i)).c_str(), block);
+ return new LoadInst(valueType, pointer, (TString("load_") += ToString(i)).c_str(), block);
};
}
@@ -356,11 +357,12 @@ public:
trunc = ConstantInt::get(Type::getInt64Ty(context), 0U);
}
- const auto dirs = new AllocaInst(ArrayType::get(Type::getInt1Ty(context), Directions.size()), 0U, "dirs", block);
+ const auto arrayType = ArrayType::get(Type::getInt1Ty(context), Directions.size());
+ const auto dirs = new AllocaInst(arrayType, 0U, "dirs", block);
for (auto i = 0U; i < Directions.size(); ++i) {
const auto dir = GetNodeValue(Directions[i], ctx, block);
const auto cut = GetterFor<bool>(dir, context, block);
- const auto ptr = GetElementPtrInst::CreateInBounds(dirs, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, "ptr", block);
+ const auto ptr = GetElementPtrInst::CreateInBounds(arrayType, dirs, {ConstantInt::get(indexType, 0), ConstantInt::get(indexType, i)}, "ptr", block);
new StoreInst(cut, ptr, block);
}
@@ -369,12 +371,12 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TWideTopWrapper::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType(), trunc->getType(), dirs->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr, trunc, dirs}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr, trunc, dirs}, "", block);
BranchInst::Create(main, block);
block = main;
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
BranchInst::Create(more, block);
@@ -386,8 +388,8 @@ public:
const auto over = BasicBlock::Create(context, "over", ctx.Func);
const auto result = PHINode::Create(statusType, 3U, "result", over);
- const auto statusPtr = GetElementPtrInst::CreateInBounds(stateArg, {stateFields.This(), stateFields.GetStatus()}, "last", block);
- const auto last = new LoadInst(statusPtr, "last", block);
+ const auto statusPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, {stateFields.This(), stateFields.GetStatus()}, "last", block);
+ const auto last = new LoadInst(statusType, statusPtr, "last", block);
const auto finish = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, last, ConstantInt::get(last->getType(), static_cast<i32>(EFetchResult::Finish)), "finish", block);
BranchInst::Create(full, loop, finish, block);
@@ -412,18 +414,18 @@ public:
const auto sealFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState<HasCount>::template Seal<Sort>));
const auto sealType = FunctionType::get(Type::getVoidTy(context), {stateArg->getType()}, false);
const auto sealPtr = CastInst::Create(Instruction::IntToPtr, sealFunc, PointerType::getUnqual(sealType), "seal", block);
- CallInst::Create(sealPtr, {stateArg}, "", block);
+ CallInst::Create(sealType, sealPtr, {stateArg}, "", block);
BranchInst::Create(full, block);
block = good;
- const auto tonguePtr = GetElementPtrInst::CreateInBounds(stateArg, { stateFields.This(), stateFields.GetTongue() }, "tongue_ptr", block);
- const auto tongue = new LoadInst(tonguePtr, "tongue", block);
+ const auto tonguePtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { stateFields.This(), stateFields.GetTongue() }, "tongue_ptr", block);
+ const auto tongue = new LoadInst(ptrValueType, tonguePtr, "tongue", block);
std::vector<Value*> placeholders(Representations.size());
for (auto i = 0U; i < placeholders.size(); ++i) {
- placeholders[i] = GetElementPtrInst::CreateInBounds(tongue, {ConstantInt::get(indexType, i)}, (TString("placeholder_") += ToString(i)).c_str(), block);
+ placeholders[i] = GetElementPtrInst::CreateInBounds(valueType, tongue, {ConstantInt::get(indexType, i)}, (TString("placeholder_") += ToString(i)).c_str(), block);
}
if constexpr (!HasCount) {
@@ -444,7 +446,7 @@ public:
const auto pushFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState<HasCount>::Push));
const auto pushType = FunctionType::get(Type::getInt1Ty(context), {stateArg->getType()}, false);
const auto pushPtr = CastInst::Create(Instruction::IntToPtr, pushFunc, PointerType::getUnqual(pushType), "function", block);
- const auto accepted = CallInst::Create(pushPtr, {stateArg}, "accepted", block);
+ const auto accepted = CallInst::Create(pushType, pushPtr, {stateArg}, "accepted", block);
if constexpr (HasCount) {
const auto push = BasicBlock::Create(context, "push", ctx.Func);
const auto skip = BasicBlock::Create(context, "skip", ctx.Func);
@@ -462,7 +464,7 @@ public:
ValueAddRef(Representations[i], item, ctx, block);
new StoreInst(item, placeholders[i], block);
}
-
+
BranchInst::Create(loop, block);
@@ -485,7 +487,7 @@ public:
const auto extractFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState<HasCount>::Extract));
const auto extractType = FunctionType::get(outputPtrType, {stateArg->getType()}, false);
const auto extractPtr = CastInst::Create(Instruction::IntToPtr, extractFunc, PointerType::getUnqual(extractType), "extract", block);
- const auto out = CallInst::Create(extractPtr, {stateArg}, "out", block);
+ const auto out = CallInst::Create(extractType, extractPtr, {stateArg}, "out", block);
const auto has = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, out, ConstantPointerNull::get(outputPtrType), "has", block);
result->addIncoming(ConstantInt::get(statusType, static_cast<i32>(EFetchResult::Finish)), block);
@@ -531,7 +533,7 @@ private:
const std::vector<EValueRepresentation> Representations;
TKeyTypes KeyTypes;
bool HasComplexType = false;
-
+
#ifndef MKQL_DISABLE_CODEGEN
TComparePtr Compare = nullptr;
@@ -577,11 +579,11 @@ IComputationNode* WrapWideTopT(TCallable& callable, const TComputationNodeFactor
const auto inputWideComponents = GetWideComponents(AS_TYPE(TFlowType, callable.GetType()->GetReturnType()));
std::vector<ui32> indexes(inputWideComponents.size());
- std::unordered_set<ui32> keyIndexes;
+ std::unordered_set<ui32> keyIndexes;
std::vector<TKeyInfo> keys(keyWidth);
for (auto i = 0U; i < keyWidth; ++i) {
- const auto keyIndex = AS_VALUE(TDataLiteral, callable.GetInput(((i + 1U) << 1U) - offset))->AsValue().Get<ui32>();
- indexes[i] = keyIndex;
+ const auto keyIndex = AS_VALUE(TDataLiteral, callable.GetInput(((i + 1U) << 1U) - offset))->AsValue().Get<ui32>();
+ indexes[i] = keyIndex;
keyIndexes.emplace(keyIndex);
bool isTuple;
@@ -618,7 +620,7 @@ IComputationNode* WrapWideTopT(TCallable& callable, const TComputationNodeFactor
std::generate(directions.begin(), directions.end(), [&](){ return LocateNode(ctx.NodeLocator, callable, ++++index); });
if (const auto wide = dynamic_cast<IComputationWideFlowNode*>(flow)) {
- return new TWideTopWrapper<Sort, HasCount>(ctx.Mutables, wide, count, std::move(directions), std::move(keys),
+ return new TWideTopWrapper<Sort, HasCount>(ctx.Mutables, wide, count, std::move(directions), std::move(keys),
std::move(indexes), std::move(representations));
}
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_withcontext.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_withcontext.cpp
index 95067dc099c..4ffac7cacaf 100644
--- a/ydb/library/yql/minikql/comp_nodes/mkql_withcontext.cpp
+++ b/ydb/library/yql/minikql/comp_nodes/mkql_withcontext.cpp
@@ -124,19 +124,19 @@ public:
const auto makeFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TWithContextFlowWrapper::MakeState));
const auto makeType = FunctionType::get(Type::getVoidTy(context), {self->getType(), ctx.Ctx->getType(), statePtr->getType()}, false);
const auto makeFuncPtr = CastInst::Create(Instruction::IntToPtr, makeFunc, PointerType::getUnqual(makeType), "function", block);
- CallInst::Create(makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
+ CallInst::Create(makeType, makeFuncPtr, {self, ctx.Ctx, statePtr}, "", block);
BranchInst::Create(main, block);
block = main;
- const auto state = new LoadInst(statePtr, "state", block);
+ const auto state = new LoadInst(valueType, statePtr, "state", block);
const auto half = CastInst::Create(Instruction::Trunc, state, Type::getInt64Ty(context), "half", block);
const auto stateArg = CastInst::Create(Instruction::IntToPtr, half, statePtrType, "state_arg", block);
const auto attachFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Attach));
const auto attachFuncType = FunctionType::get(Type::getVoidTy(context), { statePtrType }, false);
const auto attachFuncPtr = CastInst::Create(Instruction::IntToPtr, attachFunc, PointerType::getUnqual(attachFuncType), "attach", block);
- CallInst::Create(attachFuncPtr, { stateArg }, "", block);
+ CallInst::Create(attachFuncType, attachFuncPtr, { stateArg }, "", block);
const auto value = GetNodeValue(Flow, ctx, block);
const auto finish = IsFinish(value, block);
@@ -144,7 +144,7 @@ public:
const auto detachFunc = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(&TState::Detach));
const auto detachFuncType = FunctionType::get(Type::getVoidTy(context), { statePtrType, finish->getType() }, false);
const auto detachFuncPtr = CastInst::Create(Instruction::IntToPtr, detachFunc, PointerType::getUnqual(detachFuncType), "detach", block);
- CallInst::Create(detachFuncPtr, { stateArg, finish }, "", block);
+ CallInst::Create(detachFuncType, detachFuncPtr, { stateArg, finish }, "", block);
return value;
}