| ... | ... | @@ -94,8 +94,12 @@ static Buf *exec_c_import_buf(IrExecutable *exec) { |
| 94 | 94 | return exec->c_import_buf; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | static bool value_is_comptime(ConstExprValue *const_val) { |
| 98 | return const_val->special != ConstValSpecialRuntime; |
| 99 | } |
| 100 | |
| 97 | 101 | static bool instr_is_comptime(IrInstruction *instruction) { |
| 98 | | return instruction->value.special != ConstValSpecialRuntime; |
| 102 | return value_is_comptime(&instruction->value); |
| 99 | 103 | } |
| 100 | 104 | |
| 101 | 105 | static bool instr_is_unreachable(IrInstruction *instruction) { |
| ... | ... | @@ -6907,7 +6911,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 6907 | 6911 | |
| 6908 | 6912 | ConstExprValue *op1_val = &casted_op1->value; |
| 6909 | 6913 | ConstExprValue *op2_val = &casted_op2->value; |
| 6910 | | if (op1_val->special != ConstValSpecialRuntime && op2_val->special != ConstValSpecialRuntime) { |
| 6914 | if ((value_is_comptime(op1_val) && value_is_comptime(op2_val)) || resolved_type->id == TypeTableEntryIdVoid) { |
| 6911 | 6915 | bool type_can_gt_lt_cmp = (resolved_type->id == TypeTableEntryIdNumLitFloat || |
| 6912 | 6916 | resolved_type->id == TypeTableEntryIdNumLitInt || |
| 6913 | 6917 | resolved_type->id == TypeTableEntryIdFloat || |
| ... | ... | @@ -6933,7 +6937,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 6933 | 6937 | |
| 6934 | 6938 | answer = bignum_cmp(&op1_val->data.x_bignum, &op2_val->data.x_bignum); |
| 6935 | 6939 | } else { |
| 6936 | | bool are_equal = const_values_equal(op1_val, op2_val); |
| 6940 | bool are_equal = resolved_type->id == TypeTableEntryIdVoid || const_values_equal(op1_val, op2_val); |
| 6937 | 6941 | if (op_id == IrBinOpCmpEq) { |
| 6938 | 6942 | answer = are_equal; |
| 6939 | 6943 | } else if (op_id == IrBinOpCmpNotEq) { |