diff --git a/yql/essentials/minikql/comp_nodes/mkql_wide_combine.cpp b/yql/essentials/minikql/comp_nodes/mkql_wide_combine.cpp index c6f046ab9ad5..883502b7e645 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_wide_combine.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_wide_combine.cpp @@ -954,6 +954,7 @@ class TLLVMFieldsStructureState: public TLLVMFieldsStructure(MemLimit, totalUsed, ctx, block); - BranchInst::Create(done, loop, check, block); + + const auto isOutOfMemoryPtr = GetElementPtrInst::CreateInBounds(stateType, stateArg, { stateFields.This(), stateFields.GetIsOutOfMemory() }, "is_out_of_memory_ptr", block); + const auto isOutOfMemory = new LoadInst(Type::getInt1Ty(context), isOutOfMemoryPtr, "is_out_of_memory", block); + const auto checkIsOutOfMemory = CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, isOutOfMemory, ConstantInt::getTrue(context), "check_is_out_of_memory", block); + + const auto any = BinaryOperator::CreateOr(check, checkIsOutOfMemory, "any", block); + BranchInst::Create(done, loop, any, block); block = done;