| ... | @@ -94,8 +94,12 @@ static Buf *exec_c_import_buf(IrExecutable *exec) { | ... | @@ -94,8 +94,12 @@ static Buf *exec_c_import_buf(IrExecutable *exec) { |
| 94 | return exec->c_import_buf; | 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 | static bool instr_is_comptime(IrInstruction *instruction) { | 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 | static bool instr_is_unreachable(IrInstruction *instruction) { | 105 | static bool instr_is_unreachable(IrInstruction *instruction) { |
| ... | @@ -6907,7 +6911,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -6907,7 +6911,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 6907 | | 6911 | |
| 6908 | ConstExprValue *op1_val = &casted_op1->value; | 6912 | ConstExprValue *op1_val = &casted_op1->value; |
| 6909 | ConstExprValue *op2_val = &casted_op2->value; | 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 | bool type_can_gt_lt_cmp = (resolved_type->id == TypeTableEntryIdNumLitFloat || | 6915 | bool type_can_gt_lt_cmp = (resolved_type->id == TypeTableEntryIdNumLitFloat || |
| 6912 | resolved_type->id == TypeTableEntryIdNumLitInt || | 6916 | resolved_type->id == TypeTableEntryIdNumLitInt || |
| 6913 | resolved_type->id == TypeTableEntryIdFloat || | 6917 | resolved_type->id == TypeTableEntryIdFloat || |
| ... | @@ -6933,7 +6937,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -6933,7 +6937,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 6933 | | 6937 | |
| 6934 | answer = bignum_cmp(&op1_val->data.x_bignum, &op2_val->data.x_bignum); | 6938 | answer = bignum_cmp(&op1_val->data.x_bignum, &op2_val->data.x_bignum); |
| 6935 | } else { | 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 | if (op_id == IrBinOpCmpEq) { | 6941 | if (op_id == IrBinOpCmpEq) { |
| 6938 | answer = are_equal; | 6942 | answer = are_equal; |
| 6939 | } else if (op_id == IrBinOpCmpNotEq) { | 6943 | } else if (op_id == IrBinOpCmpNotEq) { |