aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2017-12-23 09:46:28 +0000
committergingerBill <bill@gingerbill.org>2017-12-23 09:46:28 +0000
commit125bad3154ea6549c10add4ed9304d35d56080ec (patch)
tree75a37ba1097b92e72bc36b09452ce024609552c8 /src/ir.cpp
parent30c83d6c8130a75f7639e29d1a4131c4b621703e (diff)
Fix 'llvm bool' emit store
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index e0802f38d..3f6741ec6 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -1542,11 +1542,15 @@ irDebugInfo *ir_add_debug_info_proc(irProcedure *proc, Entity *entity, String na
irValue *ir_emit_global_call(irProcedure *proc, char const *name_, irValue **args, isize arg_count);
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);
}
- // NOTE(bill): Sanity check
- Type *a = type_deref(ir_type(address));
+ if (a == t_llvm_bool) {
+ value = ir_emit_conv(p, value, t_llvm_bool);
+ }
+
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));