From 9e4065fa738f040dd338c613409fc1089cc33580 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 18 Sep 2019 10:52:32 -0400 Subject: [PATCH] remove TODO regarding lazy values The question was: > // TODO do we need lazy values on vector comparisons? Nope, in fact the existing code already was returning ErrorNotLazy for that particular type, and would already goto never_mind_just_calculate_it_normally. So the explicit check for ZigTypeIdVector is not needed. I appreciate the caution though. --- src/ir.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ir.cpp b/src/ir.cpp index b2a32c96d..6de08de91 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -13480,8 +13480,7 @@ static IrInstruction *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp * } if (one_possible_value || (instr_is_comptime(casted_op1) && instr_is_comptime(casted_op2))) { - // TODO do we need lazy values on vector comparisons? - if (resolved_type->id != ZigTypeIdVector) { + { // Before resolving the values, we special case comparisons against zero. These can often be done // without resolving lazy values, preventing potential dependency loops. Cmp op1_cmp_zero; @@ -13589,11 +13588,12 @@ never_mind_just_calculate_it_normally: IrInstruction *result = ir_build_bin_op(&ira->new_irb, bin_op_instruction->base.scope, bin_op_instruction->base.source_node, op_id, casted_op1, casted_op2, bin_op_instruction->safety_check_on); - if (resolved_type->id == ZigTypeIdVector) + if (resolved_type->id == ZigTypeIdVector) { result->value.type = get_vector_type(ira->codegen, resolved_type->data.vector.len, ira->codegen->builtin_types.entry_bool); - else + } else { result->value.type = ira->codegen->builtin_types.entry_bool; + } return result; }