diff options
| author | gingerBill <bill@gingerbill.org> | 2020-07-14 16:36:33 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-07-14 16:36:33 +0100 |
| commit | c18fc2da9f4aa38a2bc86b6d2c32fb8d50db4545 (patch) | |
| tree | e106b2f3f296925f8b106424778cdc92b7a647ce /src/ir.cpp | |
| parent | c4067372dddbabd327cda1d4a821ef6b343a29b1 (diff) | |
Remove some dead code
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index db6b0166a..83a512d7d 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -4737,6 +4737,14 @@ irValue *ir_emit_comp_against_nil(irProcedure *proc, TokenKind op_kind, irValue irValue *cap = ir_soa_struct_cap(proc, x); return ir_emit_comp(proc, op_kind, cap, v_zero); } + } else if (is_type_struct(t) && type_has_nil(t)) { + auto args = array_make<irValue *>(heap_allocator(), 2); + irValue *lhs = ir_address_from_load_or_generate_local(proc, x); + args[0] = ir_emit_conv(proc, lhs, t_rawptr); + args[1] = ir_const_int(type_size_of(t)); + irValue *val = ir_emit_runtime_call(proc, "memory_compare_zero", args); + irValue *res = ir_emit_comp(proc, op_kind, val, v_zero); + return ir_emit_conv(proc, res, t_bool); } return nullptr; } |