This commit is contained in:
Folkert 2021-07-24 12:33:57 +02:00
parent 59e551dd32
commit d0be0df83c
3 changed files with 5 additions and 9 deletions

View file

@ -2827,7 +2827,7 @@ fn build_switch_ir<'a, 'ctx, 'env>(
.into_int_value() .into_int_value()
} }
Layout::Union(variant) => { Layout::Union(variant) => {
cond_layout = Layout::Builtin(Builtin::Int64); cond_layout = variant.tag_id_layout();
get_tag_id(env, parent, &variant, cond_value) get_tag_id(env, parent, &variant, cond_value)
} }

View file

@ -138,11 +138,9 @@ pub fn list_prepend<'a, 'ctx, 'env>(
let list_ptr = load_list_ptr(builder, original_wrapper, ptr_type); let list_ptr = load_list_ptr(builder, original_wrapper, ptr_type);
// The output list length, which is the old list length + 1 // The output list length, which is the old list length + 1
let new_list_len = env.builder.build_int_add( let new_list_len =
ctx.i64_type().const_int(1_u64, false), env.builder
len, .build_int_add(env.ptr_int.const_int(1_u64, false), len, "new_list_length");
"new_list_length",
);
// Allocate space for the new array that we'll copy into. // Allocate space for the new array that we'll copy into.
let clone_ptr = allocate_list(env, elem_layout, new_list_len); let clone_ptr = allocate_list(env, elem_layout, new_list_len);
@ -152,7 +150,7 @@ pub fn list_prepend<'a, 'ctx, 'env>(
let index_1_ptr = unsafe { let index_1_ptr = unsafe {
builder.build_in_bounds_gep( builder.build_in_bounds_gep(
clone_ptr, clone_ptr,
&[ctx.i64_type().const_int(1_u64, false)], &[env.ptr_int.const_int(1_u64, false)],
"load_index", "load_index",
) )
}; };

View file

@ -247,8 +247,6 @@ fn insert_reset<'a>(
let reset_expr = Expr::Reset(x); let reset_expr = Expr::Reset(x);
// const I64: Layout<'static> = Layout::Builtin(crate::layout::Builtin::Int64);
let layout = Layout::Union(union_layout); let layout = Layout::Union(union_layout);
stmt = env.arena.alloc(Stmt::Let(w, reset_expr, layout, stmt)); stmt = env.arena.alloc(Stmt::Let(w, reset_expr, layout, stmt));