aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp
diff options
context:
space:
mode:
authorvvvv <vvvv@yandex-team.com>2025-01-14 11:57:29 +0300
committervvvv <vvvv@yandex-team.com>2025-01-14 12:19:19 +0300
commit5593aaf904fb630ebded70fb964bc73b39bc053a (patch)
tree8d52fa90c984c79168da59d5f12a0a13c1d8a61b /yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp
parentc84f9bf19d66e2e3d96a52f6f2181676ebca8a52 (diff)
downloadydb-5593aaf904fb630ebded70fb964bc73b39bc053a.tar.gz
minikql - llvm16 compatibility (opaque pointers and some other stuff)
commit_hash:c166e0d029d87d2a10e5adfc3acf20a849670881
Diffstat (limited to 'yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp')
-rw-r--r--yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp172
1 files changed, 92 insertions, 80 deletions
diff --git a/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp b/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp
index 113e9da8dc..7379efe3f5 100644
--- a/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp
+++ b/yql/essentials/minikql/computation/mkql_computation_node_codegen.cpp
@@ -25,19 +25,30 @@ constexpr bool EnableStaticRefcount = true;
using namespace llvm;
-Type* GetCompContextType(LLVMContext &context) {
- const auto ptrValueType = PointerType::getUnqual(Type::getInt128Ty(context));
- const auto structPtrType = PointerType::getUnqual(StructType::get(context));
+Type* GetStringRefType(LLVMContext &context) {
const auto stringRefType = StructType::get(context, {
Type::getInt8PtrTy(context),
Type::getInt32Ty(context),
Type::getInt32Ty(context)
});
+
+ return stringRefType;
+}
+
+Type* GetSourcePosType(LLVMContext &context) {
const auto sourcePosType = StructType::get(context, {
Type::getInt32Ty(context),
Type::getInt32Ty(context),
- stringRefType
+ GetStringRefType(context)
});
+
+ return sourcePosType;
+}
+
+Type* GetCompContextType(LLVMContext &context) {
+ const auto ptrValueType = PointerType::getUnqual(Type::getInt128Ty(context));
+ const auto structPtrType = PointerType::getUnqual(StructType::get(context));
+ const auto sourcePosType = GetSourcePosType(context);
return StructType::get(context, {
structPtrType, // factory
structPtrType, // stats
@@ -139,7 +150,6 @@ Function* GenerateCompareFunction(NYql::NCodegen::ICodegen& codegen, const TStri
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
DISubprogramAnnotator annotator(ctx, ctx.Func);
-
auto args = ctx.Func->arg_begin();
@@ -151,9 +161,11 @@ Function* GenerateCompareFunction(NYql::NCodegen::ICodegen& codegen, const TStri
const auto lv = &*++args;
const auto rv = &*++args;
+ const auto lvType = funcType->getParamType(1);
+ const auto rvType = funcType->getParamType(2);
- codegenLeft->SetValueBuilder([lv](const TCodegenContext&) { return lv; });
- codegenRight->SetValueBuilder([rv](const TCodegenContext&) { return rv; });
+ codegenLeft->SetValueBuilder([lv, lvType](const TCodegenContext&) { return std::make_pair(lv, lvType); });
+ codegenRight->SetValueBuilder([rv, rvType](const TCodegenContext&) { return std::make_pair(rv, rvType); });
codegenLeft->CreateInvalidate(ctx, block);
codegenRight->CreateInvalidate(ctx, block);
@@ -205,25 +217,25 @@ Value* GetMarkFromUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*
}
template<bool BoxedOrString>
-Value* GetPointerFromUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock* block) {
+std::pair<Value*,Type*> GetPointerFromUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock* block) {
auto& context = ctx.Codegen.GetContext();
const auto type32 = Type::getInt32Ty(context);
const auto type64 = Type::getInt64Ty(context);
- const auto type = PointerType::getUnqual(BoxedOrString ?
+ const auto elemType = BoxedOrString ?
StructType::get(context, {PointerType::getUnqual(StructType::get(context)), type32, Type::getInt16Ty(context)}):
- StructType::get(context, {type32, type32, type32, type32})
- );
+ StructType::get(context, {type32, type32, type32, type32});
+ const auto type = PointerType::getUnqual(elemType);
if (value->getType()->isPointerTy()) {
const auto strType = StructType::get(context, {type, type64});
const auto cast = CastInst::Create(Instruction::BitCast, value, PointerType::getUnqual(strType), "cast", block);
const auto ptr = GetElementPtrInst::CreateInBounds(strType, cast, {ConstantInt::get(type32, 0), ConstantInt::get(type32, 0)}, "ptr", block);
const auto pointer = new LoadInst(type, ptr, "pointer", block);
- return pointer;
+ return {pointer, elemType};
} else {
const auto half = CastInst::Create(Instruction::Trunc, value, type64, "half", block);
const auto pointer = CastInst::Create(Instruction::IntToPtr, half, type, "pointer", block);
- return pointer;
+ return {pointer, elemType};
}
}
@@ -291,8 +303,8 @@ Value* GenEqualsFunction<true>(NUdf::EDataSlot slot, Value* lv, Value* rv, TCode
const auto res = PHINode::Create(Type::getInt1Ty(context), 2U, "result", done);
- const auto le = IsEmpty(lv, block);
- const auto re = IsEmpty(rv, block);
+ const auto le = IsEmpty(lv, block, context);
+ const auto re = IsEmpty(rv, block, context);
const auto any = BinaryOperator::CreateOr(le, re, "or", block);
@@ -422,8 +434,8 @@ Value* GenCompareFunction<true>(NUdf::EDataSlot slot, Value* lv, Value* rv, TCod
const auto resultType = Type::getInt32Ty(context);
const auto res = PHINode::Create(resultType, 3U, "result", done);
- const auto le = IsEmpty(lv, block);
- const auto re = IsEmpty(rv, block);
+ const auto le = IsEmpty(lv, block, context);
+ const auto re = IsEmpty(rv, block, context);
const auto any = BinaryOperator::CreateOr(le, re, "or", block);
@@ -556,7 +568,7 @@ Value* GenHashFunction<true>(NUdf::EDataSlot slot, Value* value, TCodegenContext
const auto res = PHINode::Create(Type::getInt64Ty(context), 2U, "result", done);
- BranchInst::Create(tiny, test, IsEmpty(value, block), block);
+ BranchInst::Create(tiny, test, IsEmpty(value, block, context), block);
block = tiny;
@@ -577,8 +589,8 @@ Value* GenHashFunction(NUdf::EDataSlot slot, bool isOptional, Value* value, TCod
return isOptional ? GenHashFunction<true>(slot, value, ctx, block) : GenHashFunction<false>(slot, value, ctx, block);
}
-Value* LoadIfPointer(Value* value, BasicBlock* block) {
- return value->getType()->isPointerTy() ? new LoadInst(value->getType()->getPointerElementType(), value, "load_value", block) : value;
+Value* LoadIfPointer(Value* value, Type* itemType, BasicBlock* block) {
+ return value->getType()->isPointerTy() ? new LoadInst(itemType, value, "load_value", block) : value;
}
}
@@ -602,15 +614,14 @@ Function* GenerateEqualsFunction(NYql::NCodegen::ICodegen& codegen, const TStrin
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
DISubprogramAnnotator annotator(ctx, ctx.Func);
-
auto args = ctx.Func->arg_begin();
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto lv = LoadIfPointer(&*args, block);
- const auto rv = LoadIfPointer(&*++args, block);
+ const auto lv = LoadIfPointer(&*args, funcType->getParamType(0), block);
+ const auto rv = LoadIfPointer(&*++args, funcType->getParamType(1), block);
if (isTuple) {
if (types.empty()) {
@@ -734,12 +745,11 @@ Function* GenerateHashFunction(NYql::NCodegen::ICodegen& codegen, const TString&
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
DISubprogramAnnotator annotator(ctx, ctx.Func);
-
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
- const auto arg = LoadIfPointer(&*ctx.Func->arg_begin(), block);
+ const auto arg = LoadIfPointer(&*ctx.Func->arg_begin(), funcType->getParamType(0), block);
if (isTuple) {
if (types.empty()) {
@@ -825,7 +835,6 @@ Function* GenerateEqualsFunction(NYql::NCodegen::ICodegen& codegen, const TStrin
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
DISubprogramAnnotator annotator(ctx, ctx.Func);
-
auto args = ctx.Func->arg_begin();
@@ -887,7 +896,6 @@ Function* GenerateHashFunction(NYql::NCodegen::ICodegen& codegen, const TString&
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
DISubprogramAnnotator annotator(ctx, ctx.Func);
-
const auto main = BasicBlock::Create(context, "main", ctx.Func);
auto block = main;
@@ -941,7 +949,6 @@ Function* GenerateCompareFunction(NYql::NCodegen::ICodegen& codegen, const TStri
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
DISubprogramAnnotator annotator(ctx, ctx.Func);
-
auto args = ctx.Func->arg_begin();
@@ -1070,7 +1077,6 @@ Function* TExternalCodegeneratorRootNode::GenerateGetValue(NYql::NCodegen::ICode
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
DISubprogramAnnotator annotator(ctx, ctx.Func);
-
auto args = ctx.Func->arg_begin();
if (codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) {
@@ -1112,7 +1118,6 @@ Function* TExternalCodegeneratorRootNode::GenerateSetValue(NYql::NCodegen::ICode
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
DISubprogramAnnotator annotator(ctx, ctx.Func);
-
auto args = ctx.Func->arg_begin();
@@ -1123,7 +1128,7 @@ Function* TExternalCodegeneratorRootNode::GenerateSetValue(NYql::NCodegen::ICode
const auto valueArg = &*++args;
if (codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) {
- const auto value = new LoadInst(valueArg->getType()->getPointerElementType(), valueArg, "load_value", main);
+ const auto value = new LoadInst(valueArg->getType(), valueArg, "load_value", main);
CreateSetValue(ctx, main, value);
} else {
CreateSetValue(ctx, main, valueArg);
@@ -1134,13 +1139,13 @@ Function* TExternalCodegeneratorRootNode::GenerateSetValue(NYql::NCodegen::ICode
Value* TExternalCodegeneratorNode::CreateGetValue(const TCodegenContext& ctx, BasicBlock*& block) const {
if (ValueGetterBuilder) {
- llvm::Function * ValueGetter = ValueGetterBuilder(ctx);
- return CallInst::Create(ValueGetter, {ctx.Ctx}, "getter", block);
+ llvm::Function* valueGetter = ValueGetterBuilder(ctx);
+ return CallInst::Create(valueGetter, {ctx.Ctx}, "getter", block);
}
if (ValueBuilder) {
- llvm::Value * TemporaryValue = ValueBuilder(ctx);
- return LoadIfPointer(TemporaryValue, block);
+ auto [temporaryValue, itemType] = ValueBuilder(ctx);
+ return LoadIfPointer(temporaryValue, itemType, block);
}
MKQL_ENSURE(!Getter, "Wrong LLVM function generation order.");
@@ -1327,43 +1332,51 @@ ConstantInt* GetConstant(ui64 value, LLVMContext &context) {
return ConstantInt::get(context, APInt(128, 2, init));
}
-Value* IsExists(Value* value, BasicBlock* block) {
- const auto v = LoadIfPointer(value, block);
+Value* IsExists(Value* value, BasicBlock* block, LLVMContext &context) {
+ auto itemType = Type::getInt128Ty(context);
+ const auto v = LoadIfPointer(value, itemType, block);
return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, v, ConstantInt::get(v->getType(), 0ULL), "exists", block);
}
-Value* IsEmpty(Value* value, BasicBlock* block) {
- const auto v = LoadIfPointer(value, block);
+Value* IsEmpty(Value* value, BasicBlock* block, LLVMContext &context) {
+ auto itemType = Type::getInt128Ty(context);
+ const auto v = LoadIfPointer(value, itemType, block);
return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, v, ConstantInt::get(v->getType(), 0ULL), "empty", block);
}
-Value* IsInvalid(Value* value, BasicBlock* block) {
- const auto v = LoadIfPointer(value, block);
+Value* IsInvalid(Value* value, BasicBlock* block, LLVMContext &context) {
+ auto itemType = Type::getInt128Ty(context);
+ const auto v = LoadIfPointer(value, itemType, block);
return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, v, ConstantInt::get(v->getType(), InvalidData), "invalid", block);
}
-Value* IsValid(Value* value, BasicBlock* block) {
- const auto v = LoadIfPointer(value, block);
+Value* IsValid(Value* value, BasicBlock* block, LLVMContext &context) {
+ auto itemType = Type::getInt128Ty(context);
+ const auto v = LoadIfPointer(value, itemType, block);
return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, v, ConstantInt::get(v->getType(), InvalidData), "valid", block);
}
-Value* IsFinish(Value* value, BasicBlock* block) {
- const auto v = LoadIfPointer(value, block);
+Value* IsFinish(Value* value, BasicBlock* block, LLVMContext &context) {
+ auto itemType = Type::getInt128Ty(context);
+ const auto v = LoadIfPointer(value, itemType, block);
return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, v, ConstantInt::get(v->getType(), FinishData), "finish", block);
}
-Value* IsYield(Value* value, BasicBlock* block) {
- const auto v = LoadIfPointer(value, block);
+Value* IsYield(Value* value, BasicBlock* block, LLVMContext &context) {
+ auto itemType = Type::getInt128Ty(context);
+ const auto v = LoadIfPointer(value, itemType, block);
return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, v, ConstantInt::get(v->getType(), YieldData), "yield", block);
}
-Value* IsSpecial(Value* value, BasicBlock* block) {
- const auto v = LoadIfPointer(value, block);
- return BinaryOperator::CreateOr(IsFinish(v, block), IsYield(v, block), "special", block);
+Value* IsSpecial(Value* value, BasicBlock* block, LLVMContext &context) {
+ auto itemType = Type::getInt128Ty(context);
+ const auto v = LoadIfPointer(value, itemType, block);
+ return BinaryOperator::CreateOr(IsFinish(v, block, context), IsYield(v, block, context), "special", block);
}
-Value* HasValue(Value* value, BasicBlock* block) {
- const auto v = LoadIfPointer(value, block);
+Value* HasValue(Value* value, BasicBlock* block, LLVMContext &context) {
+ auto itemType = Type::getInt128Ty(context);
+ const auto v = LoadIfPointer(value, itemType, block);
return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_UGT, v, ConstantInt::get(v->getType(), InvalidData), "has", block);
}
@@ -1423,7 +1436,7 @@ template<> Type* GetTypeFor<double>(LLVMContext &context) { return Type::getDoub
void AddRefBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
auto& context = ctx.Codegen.GetContext();
- const auto load = value->getType()->isPointerTy() ? new LoadInst(value->getType()->getPointerElementType(), value, "load", block) : value;
+ const auto load = value->getType()->isPointerTy() ? new LoadInst(value->getType(), value, "load", block) : value;
const auto half = CastInst::Create(Instruction::Trunc, load, Type::getInt64Ty(context), "half", block);
const auto counterType = Type::getInt32Ty(context);
const auto type = StructType::get(context, {PointerType::getUnqual(StructType::get(context)), counterType, Type::getInt16Ty(context)});
@@ -1455,7 +1468,7 @@ void AddRefBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
void UnRefBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
auto& context = ctx.Codegen.GetContext();
- const auto load = value->getType()->isPointerTy() ? new LoadInst(value->getType()->getPointerElementType(), value, "load", block) : value;
+ const auto load = value->getType()->isPointerTy() ? new LoadInst(value->getType(), value, "load", block) : value;
const auto half = CastInst::Create(Instruction::Trunc, load, Type::getInt64Ty(context), "half", block);
const auto counterType = Type::getInt32Ty(context);
const auto type = StructType::get(context, {PointerType::getUnqual(StructType::get(context)), counterType, Type::getInt16Ty(context)});
@@ -1498,7 +1511,7 @@ void UnRefBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
void CleanupBoxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block) {
auto& context = ctx.Codegen.GetContext();
- const auto load = value->getType()->isPointerTy() ? new LoadInst(value->getType()->getPointerElementType(), value, "load", block) : value;
+ const auto load = value->getType()->isPointerTy() ? new LoadInst(value->getType(), value, "load", block) : value;
const auto half = CastInst::Create(Instruction::Trunc, load, Type::getInt64Ty(context), "half", block);
const auto counterType = Type::getInt32Ty(context);
const auto type = StructType::get(context, {PointerType::getUnqual(StructType::get(context)), counterType, Type::getInt16Ty(context)});
@@ -1549,8 +1562,8 @@ void ChangeRefUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*& blo
{
block = strb;
- const auto strptr = GetPointerFromUnboxed<false>(value, ctx, block);
- const auto elemptr = GetElementPtrInst::CreateInBounds(strptr->getType()->getPointerElementType(), strptr, {ConstantInt::get(type32, 0), ConstantInt::get(type32, 1)}, "elemptr", block);
+ const auto [strptr, strtype] = GetPointerFromUnboxed<false>(value, ctx, block);
+ const auto elemptr = GetElementPtrInst::CreateInBounds(strtype, strptr, {ConstantInt::get(type32, 0), ConstantInt::get(type32, 1)}, "elemptr", block);
refsptr->addIncoming(elemptr, block);
BranchInst::Create(doit, block);
}
@@ -1558,8 +1571,8 @@ void ChangeRefUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*& blo
{
block = boxb;
- const auto boxptr = GetPointerFromUnboxed<true>(value, ctx, block);;
- const auto elemptr = GetElementPtrInst::CreateInBounds(boxptr->getType()->getPointerElementType(), boxptr, {ConstantInt::get(type32, 0), ConstantInt::get(type32, 1)}, "elemptr", block);
+ const auto [boxptr, boxtype] = GetPointerFromUnboxed<true>(value, ctx, block);
+ const auto elemptr = GetElementPtrInst::CreateInBounds(boxtype, boxptr, {ConstantInt::get(type32, 0), ConstantInt::get(type32, 1)}, "elemptr", block);
refsptr->addIncoming(elemptr, block);
BranchInst::Create(doit, block);
}
@@ -1606,8 +1619,8 @@ void CheckRefUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*& bloc
{
block = strb;
- const auto strptr = GetPointerFromUnboxed<false>(value, ctx, block);
- const auto refptr = GetElementPtrInst::CreateInBounds(strptr->getType()->getPointerElementType(), strptr, {ConstantInt::get(type32, 0), ConstantInt::get(type32, 1)}, "refptr", block);
+ const auto [strptr, strtype] = GetPointerFromUnboxed<false>(value, ctx, 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);
#if UDF_ABI_COMPATIBILITY_VERSION_CURRENT >= UDF_ABI_COMPATIBILITY_VERSION(2, 4)
@@ -1647,8 +1660,8 @@ void CheckRefUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*& bloc
{
block = boxb;
- const auto boxptr = GetPointerFromUnboxed<true>(value, ctx, block);;
- const auto refptr = GetElementPtrInst::CreateInBounds(boxptr->getType()->getPointerElementType(), boxptr, {ConstantInt::get(type32, 0), ConstantInt::get(type32, 1)}, "cntptr", block);
+ const auto [boxptr, boxtype] = GetPointerFromUnboxed<true>(value, ctx, block);;
+ const auto refptr = GetElementPtrInst::CreateInBounds(boxtype, boxptr, {ConstantInt::get(type32, 0), ConstantInt::get(type32, 1)}, "cntptr", block);
const auto refs = new LoadInst(type32, refptr, "refs", block);
#if UDF_ABI_COMPATIBILITY_VERSION_CURRENT >= UDF_ABI_COMPATIBILITY_VERSION(2, 4)
@@ -1743,20 +1756,22 @@ void CleanupUnboxed(Value* value, const TCodegenContext& ctx, BasicBlock*& block
}
#endif
-void SafeUnRefUnboxed(Value* pointer, const TCodegenContext& ctx, BasicBlock*& block) {
- if (const auto itemType = pointer->getType()->getPointerElementType(); itemType->isArrayTy()) {
- const auto indexType = Type::getInt64Ty(ctx.Codegen.GetContext());
- Value* zeros = UndefValue::get(itemType);
- for (ui32 idx = 0U; idx < itemType->getArrayNumElements(); ++idx) {
- const auto item = GetElementPtrInst::CreateInBounds(itemType, pointer, { ConstantInt::get(indexType, 0), ConstantInt::get(indexType, idx) }, (TString("item_") += ToString(idx)).c_str(), block);
- UnRefUnboxed(item, ctx, block);
- zeros = InsertValueInst::Create(zeros, ConstantInt::get(itemType->getArrayElementType(), 0), {idx}, (TString("zero_") += ToString(idx)).c_str(), block);
- }
- new StoreInst(zeros, pointer, block);
- } else {
- UnRefUnboxed(pointer, ctx, block);
- new StoreInst(ConstantInt::get(itemType, 0), pointer, block);
+void SafeUnRefUnboxedOne(Value* pointer, const TCodegenContext& ctx, BasicBlock*& block) {
+ auto itemType = Type::getInt128Ty(ctx.Codegen.GetContext());
+ UnRefUnboxed(pointer, ctx, block);
+ new StoreInst(ConstantInt::get(itemType, 0), pointer, block);
+}
+
+void SafeUnRefUnboxedArray(Value* pointer, ArrayType* arrayType, const TCodegenContext& ctx, BasicBlock*& block) {
+ auto itemType = arrayType->getElementType();
+ const auto indexType = Type::getInt64Ty(ctx.Codegen.GetContext());
+ Value* zeros = UndefValue::get(itemType);
+ for (ui32 idx = 0U; idx < arrayType->getNumElements(); ++idx) {
+ const auto item = GetElementPtrInst::CreateInBounds(itemType, pointer, { ConstantInt::get(indexType, 0), ConstantInt::get(indexType, idx) }, (TString("item_") += ToString(idx)).c_str(), block);
+ UnRefUnboxed(item, ctx, block);
+ zeros = InsertValueInst::Create(zeros, ConstantInt::get(itemType->getArrayElementType(), 0), {idx}, (TString("zero_") += ToString(idx)).c_str(), block);
}
+ new StoreInst(zeros, pointer, block);
}
void ValueAddRef(EValueRepresentation kind, Value* pointer, const TCodegenContext& ctx, BasicBlock*& block) {
@@ -2358,7 +2373,7 @@ Y_NO_INLINE Value* TPairStateFlowCodegeneratorNodeBase::CreateGetValueImpl(
}
}
-Y_NO_INLINE Value* TBinaryCodegeneratorNodeBase::CreateGetValueImpl(const IComputationNode* node,
+Y_NO_INLINE Value* TBinaryCodegeneratorNodeBase::CreateGetValueImpl(const IComputationNode* node,
const TCodegenContext& ctx, BasicBlock*& block) const {
const auto value = DoGenerateGetValue(ctx, block);
if (value->getType()->isPointerTy()) {
@@ -2401,7 +2416,6 @@ Function* TMutableCodegeneratorNodeBase::GenerateInternalGetValue(const TString&
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
DISubprogramAnnotator annotator(ctx, ctx.Func);
-
auto main = BasicBlock::Create(context, "main", ctx.Func);
ctx.Ctx = &*ctx.Func->arg_begin();
@@ -2509,7 +2523,6 @@ Function* TMutableCodegeneratorPtrNodeBase::GenerateInternalGetValue(const TStri
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
DISubprogramAnnotator annotator(ctx, ctx.Func);
-
auto main = BasicBlock::Create(context, "main", ctx.Func);
ctx.Ctx = &*ctx.Func->arg_begin();
@@ -2562,7 +2575,6 @@ Y_NO_INLINE Function* TCodegeneratorRootNodeBase::GenerateGetValueImpl(
ctx.Func = cast<Function>(module.getOrInsertFunction(name.c_str(), funcType).getCallee());
DISubprogramAnnotator annotator(ctx, ctx.Func);
-
auto args = ctx.Func->arg_begin();
if (codegen.GetEffectiveTarget() == NYql::NCodegen::ETarget::Windows) {