aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-01-17 14:06:06 +0000
committergingerBill <bill@gingerbill.org>2018-01-17 14:06:06 +0000
commit5558b55e9f1f7b80c052bc803fd43f317849f98c (patch)
treef1108acb0f6d185a3ae8d96f99162974396d9c12 /src/ir.cpp
parent4b14d608f49eae90e683cf114bf2a7215a7e857f (diff)
Fix ir_emit_store for booleans
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 61014247b..36e4836d2 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -1544,21 +1544,15 @@ irValue *ir_emit_global_call(irProcedure *proc, char const *name_, irValue **arg
irValue *ir_emit_store(irProcedure *p, irValue *address, irValue *value) {
Type *a = type_deref(ir_type(address));
- if (ir_type(value) == t_llvm_bool) {
- value = ir_emit_conv(p, value, t_bool);
- }
- if (a == t_llvm_bool) {
- value = ir_emit_conv(p, value, t_llvm_bool);
+ if (is_type_boolean(a)) {
+ // NOTE(bill): There are multiple sized booleans, thus force a conversion (if necessarily)
+ value = ir_emit_conv(p, value, a);
}
Type *b = ir_type(value);
if (!is_type_untyped(b)) {
GB_ASSERT_MSG(are_types_identical(core_type(a), core_type(b)), "%s %s", type_to_string(a), type_to_string(b));
}
-
- // if (is_type_boolean(a)) {
- // return ir_emit(p, ir_instr_store_bool(p, address, value, false));
- // }
return ir_emit(p, ir_instr_store(p, address, value, false));
}
irValue *ir_emit_load(irProcedure *p, irValue *address) {