diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2023-05-08 11:31:26 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2023-05-08 11:31:26 +0300 |
commit | c70598f69da8a7004b8a2a0e2120b62c2584ce2c (patch) | |
tree | ad17cf5bdb6eafb3581d17ea5751acbaf425aa6e | |
parent | 7516af0e3476946c5739294eb0ab41f465dea027 (diff) | |
download | ydb-c70598f69da8a7004b8a2a0e2120b62c2584ce2c.tar.gz |
YQL-15941 Some steps to LLVM14.
13 files changed, 46 insertions, 42 deletions
diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_llvm_base.h b/ydb/library/yql/minikql/comp_nodes/mkql_llvm_base.h index 9b9cf53bb6..2ea90be43b 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_llvm_base.h +++ b/ydb/library/yql/minikql/comp_nodes/mkql_llvm_base.h @@ -1,10 +1,10 @@ #pragma once #include <ydb/library/yql/minikql/computation/mkql_computation_node_impl.h> -#include <contrib/libs/llvm12/include/llvm/IR/LLVMContext.h> -#include <contrib/libs/llvm12/include/llvm/IR/Type.h> -#include <contrib/libs/llvm12/include/llvm/IR/Constant.h> -#include <contrib/libs/llvm12/include/llvm/IR/DerivedTypes.h> -#include <contrib/libs/llvm12/include/llvm/IR/Constants.h> +#include <llvm/IR/LLVMContext.h> +#include <llvm/IR/Type.h> +#include <llvm/IR/Constant.h> +#include <llvm/IR/DerivedTypes.h> +#include <llvm/IR/Constants.h> namespace NKikimr::NMiniKQL { template <class T> diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp index 0c399e66b1..cc3380bdf5 100644 --- a/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp +++ b/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp @@ -672,12 +672,13 @@ public: const auto valType = Type::getInt128Ty(context); const auto idxType = Type::getInt32Ty(context); const auto type = ArrayType::get(valType, ValueNodes.size()); + const auto ptrType = PointerType::getUnqual(type); /// TODO: how to get computation context or other workaround 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(ptrType, 0U, "itms", &ctx.Func->getEntryBlock().back()): + new AllocaInst(ptrType, 0U, "itms", block); const auto result = Cache.GenNewArray(ValueNodes.size(), itms, ctx, block); - const auto itemsPtr = new LoadInst(itms, "items", block); + const auto itemsPtr = new LoadInst(ptrType, itms, "items", block); ui32 i = 0U; for (const auto node : ValueNodes) { @@ -717,14 +718,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, func, PointerType::getUnqual(funType), "function", block); - const auto res = CallInst::Create(funcPtr, {factory}, "res", block); + const auto res = CallInst::Create(funType, funcPtr, {factory}, "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()}, false); const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funcPtr, {factory, retPtr}, "", block); - const auto res = new LoadInst(retPtr, "res", block); + CallInst::Create(funType, funcPtr, {factory, retPtr}, "", block); + const auto res = new LoadInst(valueType, retPtr, "res", block); return res; } } @@ -4032,7 +4033,7 @@ Value* GenerateCheckNotUniqueBoxed(Value* value, LLVMContext& context, Function* const auto type = StructType::get(context, {PointerType::getUnqual(StructType::get(context)), Type::getInt32Ty(context), Type::getInt16Ty(context)}); const auto boxptr = CastInst::Create(Instruction::IntToPtr, half, PointerType::getUnqual(type), "boxptr", block); const auto cntptr = GetElementPtrInst::CreateInBounds(boxptr, {ConstantInt::get(Type::getInt32Ty(context), 0), ConstantInt::get(Type::getInt32Ty(context), 1)}, "cntptr", block); - const auto refs = new LoadInst(cntptr, "refs", block); + const auto refs = new LoadInst(Type::getInt32Ty(context), cntptr, "refs", block); const auto many = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_UGT, refs, ConstantInt::get(refs->getType(), 1U), "many", block); result->addIncoming(many, block); BranchInst::Create(done, block); @@ -4055,15 +4056,15 @@ Value* TContainerCacheOnContext::GenNewArray(ui64 sz, Value* items, const TCodeg const auto indexPtr = GetElementPtrInst::CreateInBounds(values, {ConstantInt::get(idxType, Index)}, "index_ptr", block); - const auto raw = new LoadInst(indexPtr, "raw", block); + const auto raw = new LoadInst(valueType, indexPtr, "raw", block); const auto indb = GetterFor<bool>(raw, context, block); - const auto indf = new ZExtInst(indb, idxType, "indf", block); + const auto indf = CastInst::Create(Instruction::ZExt, indb, idxType, "indf", block); const auto ind_one = BinaryOperator::CreateAdd(indf, ConstantInt::get(idxType, Index + 1U), "ind_one", block); const auto tpfirst = GetElementPtrInst::CreateInBounds(values, {ind_one}, "tpfirst", block); - const auto tfirst = new LoadInst(tpfirst, "tfirst", block); + const auto tfirst = new LoadInst(valueType, tpfirst, "tfirst", block); const auto cfirst = GenerateCheckNotUniqueBoxed(tfirst, context, ctx.Func, block); const auto scnd = BasicBlock::Create(context, "scnd", ctx.Func); @@ -4083,12 +4084,12 @@ Value* TContainerCacheOnContext::GenNewArray(ui64 sz, Value* items, const TCodeg const auto newInd = SetterFor<bool>(neg, context, block); new StoreInst(newInd, indexPtr, block); - const auto inds = new ZExtInst(neg, idxType, "inds", block); + const auto inds = CastInst::Create(Instruction::ZExt, neg, idxType, "inds", block); const auto ind_two = BinaryOperator::CreateAdd(inds, ConstantInt::get(idxType, Index + 1U), "ind_two", block); const auto tpsecond = GetElementPtrInst::CreateInBounds(values, {ind_two}, "tpsecond", block); - const auto tsecond = new LoadInst(tpsecond, "tsecond", block); + const auto tsecond = new LoadInst(valueType, tpsecond, "tsecond", block); const auto csecond = GenerateCheckNotUniqueBoxed(tsecond, context, ctx.Func, block); has->addIncoming(tsecond, block); BranchInst::Create(make, have, csecond, block); @@ -4105,15 +4106,15 @@ Value* TContainerCacheOnContext::GenNewArray(ui64 sz, Value* items, const TCodeg if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) { const auto funType = FunctionType::get(valueType, {fact->getType(), size->getType(), items->getType()}, false); const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - const auto array = CallInst::Create(funcPtr, {fact, size, items}, "array", block); + const auto array = CallInst::Create(funType, funcPtr, {fact, size, items}, "array", block); AddRefBoxed(array, ctx, block); result->addIncoming(array, block); new StoreInst(array, tpsecond, block); } else { const auto funType = FunctionType::get(Type::getVoidTy(context), {fact->getType(), tpsecond->getType(), size->getType(), items->getType()}, false); const auto funcPtr = CastInst::Create(Instruction::IntToPtr, func, PointerType::getUnqual(funType), "function", block); - CallInst::Create(funcPtr, {fact, tpsecond, size, items}, "", block); - const auto array = new LoadInst(tpsecond, "array", block); + CallInst::Create(funType, funcPtr, {fact, tpsecond, size, items}, "", block); + const auto array = new LoadInst(valueType, tpsecond, "array", block); AddRefBoxed(array, ctx, block); result->addIncoming(array, block); } diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_abs.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_abs.cpp index ba308a35c6..a3f76e0800 100644 --- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_abs.cpp +++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_abs.cpp @@ -39,7 +39,7 @@ struct TAbs : public TSimpleArithmeticUnary<TInput, TOutput, TAbs<TInput, TOutpu const auto fnType = FunctionType::get(arg->getType(), {arg->getType()}, false); const auto& name = GetFuncNameForType<TInput>("llvm.fabs"); const auto func = module.getOrInsertFunction(name, fnType).getCallee(); - const auto res = CallInst::Create(func, {arg}, "fabs", block); + const auto res = CallInst::Create(fnType, func, {arg}, "fabs", block); return res; } else { const auto zero = ConstantInt::get(arg->getType(), 0); diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_byteat.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_byteat.cpp index 613aff688c..dfe99e667f 100644 --- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_byteat.cpp +++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_byteat.cpp @@ -91,8 +91,8 @@ struct TByteAt { const auto half = CastInst::Create(Instruction::Trunc, left, Type::getInt64Ty(context), "half", block); const auto ptr = CastInst::Create(Instruction::IntToPtr, half, PointerType::getUnqual(type) , "ptr", block); - const auto bytePtr = GetElementPtrInst::CreateInBounds(ptr, {pos}, "bptr", block); - const auto got = new LoadInst(bytePtr, "got", block); + const auto bytePtr = GetElementPtrInst::CreateInBounds(type, ptr, {pos}, "bptr", block); + const auto got = new LoadInst(type, bytePtr, "got", block); const auto make = SetterFor<ui8>(got, context, block); result->addIncoming(make, block); BranchInst::Create(done, block); diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_convert.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_convert.cpp index 43f7287be2..14016edadd 100644 --- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_convert.cpp +++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_convert.cpp @@ -46,7 +46,7 @@ struct TFloatToIntegralImpl { const auto name = std::is_same<TIn, float>() ? "MyFloatClassify" : "MyDoubleClassify"; ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(static_cast<int(*)(TIn)>(&std::fpclassify))); const auto func = module.getOrInsertFunction(name, fnType).getCallee(); - const auto classify = CallInst::Create(func, {val}, "fpclassify", block); + const auto classify = CallInst::Create(fnType, func, {val}, "fpclassify", block); const auto none = BasicBlock::Create(context, "none", ctx.Func); const auto zero = BasicBlock::Create(context, "zero", ctx.Func); @@ -113,7 +113,7 @@ struct TFloatToIntegralImpl<TIn, bool> { const auto name = std::is_same<TIn, float>() ? "MyFloatClassify" : "MyDoubleClassify"; ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(static_cast<int(*)(TIn)>(&std::fpclassify))); const auto func = module.getOrInsertFunction(name, fnType).getCallee(); - const auto classify = CallInst::Create(func, {val}, "fpclassify", block); + const auto classify = CallInst::Create(fnType, func, {val}, "fpclassify", block); const auto none = BasicBlock::Create(context, "none", ctx.Func); const auto zero = BasicBlock::Create(context, "zero", ctx.Func); @@ -401,7 +401,7 @@ struct TJsonToJsonDocumentConvert { const auto functionAddress = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(JsonToJsonDocument)); const auto functionType = FunctionType::get(json->getType(), {json->getType()}, /* isVarArg */ false); const auto functionPtr = CastInst::Create(Instruction::IntToPtr, functionAddress, PointerType::getUnqual(functionType), "func", block); - return CallInst::Create(functionPtr, {json}, "jsonToJsonDocument", block); + return CallInst::Create(functionType, functionPtr, {json}, "jsonToJsonDocument", block); } #endif }; @@ -424,7 +424,7 @@ struct TJsonDocumentToJsonConvert { const auto functionAddress = ConstantInt::get(Type::getInt64Ty(context), GetMethodPtr(JsonDocumentToJson)); const auto functionType = FunctionType::get(jsonDocument->getType(), {jsonDocument->getType()}, /* isVarArg */ false); const auto functionPtr = CastInst::Create(Instruction::IntToPtr, functionAddress, PointerType::getUnqual(functionType), "func", block); - return CallInst::Create(functionPtr, {jsonDocument}, "jsonDocumentToJson", block); + return CallInst::Create(functionType, functionPtr, {jsonDocument}, "jsonDocumentToJson", block); } #endif }; diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_countbits.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_countbits.cpp index 725148683e..8b11f9eb6f 100644 --- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_countbits.cpp +++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_countbits.cpp @@ -22,7 +22,7 @@ struct TCountBits : public TSimpleArithmeticUnary<TInput, TOutput, TCountBits<TI const auto fnType = FunctionType::get(arg->getType(), {arg->getType()}, false); const auto& name = GetFuncNameForType<TInput>("llvm.ctpop"); const auto func = module.getOrInsertFunction(name, fnType).getCallee(); - const auto result = CallInst::Create(func, {arg}, "popcount", block); + const auto result = CallInst::Create(fnType, func, {arg}, "popcount", block); return StaticCast<TInput, TOutput>(result, context, block); } #endif diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_find.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_find.cpp index 7462f939e9..15893dad47 100644 --- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_find.cpp +++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_find.cpp @@ -37,7 +37,7 @@ struct TFind { if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) { const auto funType = FunctionType::get(string->getType(), {string->getType(), sub->getType(), pos->getType()}, false); const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block); - const auto result = CallInst::Create(funcPtr, {string, sub, pos}, "find", block); + const auto result = CallInst::Create(funType, funcPtr, {string, sub, pos}, "find", block); return result; } else { const auto ptrArg = new AllocaInst(string->getType(), 0U, "arg", block); @@ -47,8 +47,8 @@ struct TFind { new StoreInst(sub, ptrSub, block); const auto funType = FunctionType::get(Type::getVoidTy(context), {ptrResult->getType(), ptrArg->getType(), ptrSub->getType(), pos->getType()}, false); const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block); - CallInst::Create(funcPtr, {ptrResult, ptrArg, ptrSub, pos}, "", block); - const auto result = new LoadInst(ptrResult, "find", block); + CallInst::Create(funType, funcPtr, {ptrResult, ptrArg, ptrSub, pos}, "", block); + const auto result = new LoadInst(string->getType(), ptrResult, "find", block); return result; } } diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_max.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_max.cpp index 137eb07880..8b5b7f4a3e 100644 --- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_max.cpp +++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_max.cpp @@ -34,7 +34,7 @@ struct TMax : public TSimpleArithmeticBinary<TLeft, TRight, TOutput, TMax<TLeft, const auto fnType = FunctionType::get(GetTypeFor<TOutput>(context), {left->getType(), right->getType()}, false); const auto& name = GetFuncNameForType<TOutput>("llvm.maxnum"); const auto func = module.getOrInsertFunction(name, fnType).getCallee(); - const auto res = CallInst::Create(func, {left, right}, "maxnum", block); + const auto res = CallInst::Create(fnType, func, {left, right}, "maxnum", block); return res; } else { const auto check = CmpInst::Create(Instruction::ICmp, std::is_signed<TOutput>() ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT, left, right, "less", block); diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_min.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_min.cpp index f3049f0ef0..483d18aa89 100644 --- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_min.cpp +++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_min.cpp @@ -34,7 +34,7 @@ struct TMin : public TSimpleArithmeticBinary<TLeft, TRight, TOutput, TMin<TLeft, const auto fnType = FunctionType::get(GetTypeFor<TOutput>(context), {left->getType(), right->getType()}, false); const auto& name = GetFuncNameForType<TOutput>("llvm.minnum"); const auto func = module.getOrInsertFunction(name, fnType).getCallee(); - const auto res = CallInst::Create(func, {left, right}, "minnum", block); + const auto res = CallInst::Create(fnType, func, {left, right}, "minnum", block); return res; } else { const auto check = CmpInst::Create(Instruction::ICmp, std::is_signed<TOutput>() ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT, left, right, "greater", block); diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_minus.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_minus.cpp index 340f2301b5..2ab6f62891 100644 --- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_minus.cpp +++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_minus.cpp @@ -15,7 +15,10 @@ struct TMinus : public TSimpleArithmeticUnary<TInput, TOutput, TMinus<TInput, TO #ifndef MKQL_DISABLE_CODEGEN static Value* Gen(Value* arg, const TCodegenContext&, BasicBlock*& block) { - return std::is_integral<TInput>() ? BinaryOperator::CreateNeg(arg, "neg", block) : BinaryOperator::CreateFNeg(arg, "neg", block); + if constexpr (std::is_integral<TInput>()) + return BinaryOperator::CreateNeg(arg, "neg", block); + else + return UnaryOperator::CreateFNeg(arg, "neg", block); } #endif }; diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_nanvl.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_nanvl.cpp index bbbed3dfff..7dbe9a24df 100644 --- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_nanvl.cpp +++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_nanvl.cpp @@ -38,7 +38,7 @@ struct TNanvl { const auto name = std::is_same<TLeft, float>() ? "MyFloatIsNan" : "MyDoubleIsNan"; ctx.Codegen->AddGlobalMapping(name, reinterpret_cast<const void*>(static_cast<bool(*)(TLeft)>(&std::isnan))); const auto func = module.getOrInsertFunction(name, fnType).getCallee(); - const auto isnan = CallInst::Create(func, {val}, "isnan", block); + const auto isnan = CallInst::Create(fnType, func, {val}, "isnan", block); const auto lout = std::is_same<TLeft, TOutput>() ? left : SetterFor<TOutput>(StaticCast<TLeft, TOutput>(val, context, block), context, block); const auto rout = std::is_same<TRight, TOutput>() ? right : SetterFor<TOutput>(StaticCast<TRight, TOutput>(GetterFor<TRight>(right, context, block), context, block), context, block); diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_substring.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_substring.cpp index 1a35ce31d3..41359df6ce 100644 --- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_substring.cpp +++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_substring.cpp @@ -38,7 +38,7 @@ struct TSubString { if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) { const auto funType = FunctionType::get(string->getType(), {string->getType(), start->getType(), count->getType()}, false); const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block); - const auto result = CallInst::Create(funcPtr, {string, start, count}, "substring", block); + const auto result = CallInst::Create(funType, funcPtr, {string, start, count}, "substring", block); return result; } else { const auto ptrArg = new AllocaInst(string->getType(), 0U, "arg", block); @@ -46,8 +46,8 @@ struct TSubString { new StoreInst(string, ptrArg, block); const auto funType = FunctionType::get(Type::getVoidTy(context), {ptrResult->getType(), ptrArg->getType(), start->getType(), count->getType()}, false); const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block); - CallInst::Create(funcPtr, {ptrResult, ptrArg, start, count}, "", block); - const auto result = new LoadInst(ptrResult, "substring", block); + CallInst::Create(funType, funcPtr, {ptrResult, ptrArg, start, count}, "", block); + const auto result = new LoadInst(string->getType(), ptrResult, "substring", block); return result; } } diff --git a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_with.cpp b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_with.cpp index dae4009802..058a643f7e 100644 --- a/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_with.cpp +++ b/ydb/library/yql/minikql/invoke_builtins/mkql_builtins_with.cpp @@ -15,7 +15,7 @@ NUdf::TUnboxedValuePod StringWith(const NUdf::TUnboxedValuePod full, const NUdf: NUdf::TUnboxedValuePod StringContains(const NUdf::TUnboxedValuePod full, const NUdf::TUnboxedValuePod part) { const std::string_view one = full.AsStringRef(); const std::string_view two = part.AsStringRef(); - return NUdf::TUnboxedValuePod(std::string_view::npos != one.find(two)); + return NUdf::TUnboxedValuePod(one.contains(two)); } template <NUdf::TUnboxedValuePod (*StringFunc)(const NUdf::TUnboxedValuePod full, const NUdf::TUnboxedValuePod part)> @@ -32,7 +32,7 @@ struct TStringWith { if (NYql::NCodegen::ETarget::Windows != ctx.Codegen->GetEffectiveTarget()) { const auto funType = FunctionType::get(string->getType(), {string->getType(), sub->getType()}, false); const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block); - const auto result = CallInst::Create(funcPtr, {string, sub}, "has", block); + const auto result = CallInst::Create(funType, funcPtr, {string, sub}, "has", block); return result; } else { const auto ptrArg = new AllocaInst(string->getType(), 0U, "arg", block); @@ -42,8 +42,8 @@ struct TStringWith { new StoreInst(sub, ptrSub, block); const auto funType = FunctionType::get(Type::getVoidTy(context), {ptrResult->getType(), ptrArg->getType(), ptrSub->getType()}, false); const auto funcPtr = CastInst::Create(Instruction::IntToPtr, doFunc, PointerType::getUnqual(funType), "func", block); - CallInst::Create(funcPtr, {ptrResult, ptrArg, ptrSub}, "", block); - const auto result = new LoadInst(ptrResult, "has", block); + CallInst::Create(funType, funcPtr, {ptrResult, ptrArg, ptrSub}, "", block); + const auto result = new LoadInst(string->getType(), ptrResult, "has", block); return result; } } |