diff options
| author | Jimmi Holst Christensen <jimmiholstchristensen@gmail.com> | 2018-06-30 21:22:26 +0200 |
|---|---|---|
| committer | Jimmi Holst Christensen <jimmiholstchristensen@gmail.com> | 2018-06-30 21:22:26 +0200 |
| commit | 055e0fef4eaa2d8c6dcbd83180baa44d88be3b4d (patch) | |
| tree | f2cc0169f513598374133b577979ec604e9315cc /src | |
| parent | ecd5e60be9cab03449e0d40a770c5a0c5582198d (diff) | |
| download | zig-055e0fef4eaa2d8c6dcbd83180baa44d88be3b4d.tar.gz zig-055e0fef4eaa2d8c6dcbd83180baa44d88be3b4d.zip | |
Avoid resolve_const in cmp when instr are not comptime
Diffstat (limited to 'src')
| -rw-r--r-- | src/ir.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 0f1e632299..ce2e333227 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -11029,10 +11029,10 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp bool one_possible_value = !type_requires_comptime(resolved_type) && !type_has_bits(resolved_type); if (one_possible_value || (instr_is_comptime(casted_op1) && instr_is_comptime(casted_op2))) { - ConstExprValue *op1_val = ir_resolve_const(ira, casted_op1, UndefBad); + ConstExprValue *op1_val = one_possible_value ? &casted_op1->value : ir_resolve_const(ira, casted_op1, UndefBad); if (op1_val == nullptr) return ira->codegen->builtin_types.entry_invalid; - ConstExprValue *op2_val = ir_resolve_const(ira, casted_op2, UndefBad); + ConstExprValue *op2_val = one_possible_value ? &casted_op2->value : ir_resolve_const(ira, casted_op2, UndefBad); if (op2_val == nullptr) return ira->codegen->builtin_types.entry_invalid; |
