From d0be0df83c2559c0453b1a48723b2bc6c693762b Mon Sep 17 00:00:00 2001 From: Folkert Date: Sat, 24 Jul 2021 12:33:57 +0200 Subject: [PATCH] tweaks --- compiler/gen_llvm/src/llvm/build.rs | 2 +- compiler/gen_llvm/src/llvm/build_list.rs | 10 ++++------ compiler/mono/src/reset_reuse.rs | 2 -- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/compiler/gen_llvm/src/llvm/build.rs b/compiler/gen_llvm/src/llvm/build.rs index 5dfac70e87..dbb45535a2 100644 --- a/compiler/gen_llvm/src/llvm/build.rs +++ b/compiler/gen_llvm/src/llvm/build.rs @@ -2827,7 +2827,7 @@ fn build_switch_ir<'a, 'ctx, 'env>( .into_int_value() } Layout::Union(variant) => { - cond_layout = Layout::Builtin(Builtin::Int64); + cond_layout = variant.tag_id_layout(); get_tag_id(env, parent, &variant, cond_value) } diff --git a/compiler/gen_llvm/src/llvm/build_list.rs b/compiler/gen_llvm/src/llvm/build_list.rs index 7aa7e07ead..0556a6091e 100644 --- a/compiler/gen_llvm/src/llvm/build_list.rs +++ b/compiler/gen_llvm/src/llvm/build_list.rs @@ -138,11 +138,9 @@ pub fn list_prepend<'a, 'ctx, 'env>( let list_ptr = load_list_ptr(builder, original_wrapper, ptr_type); // The output list length, which is the old list length + 1 - let new_list_len = env.builder.build_int_add( - ctx.i64_type().const_int(1_u64, false), - len, - "new_list_length", - ); + let new_list_len = + env.builder + .build_int_add(env.ptr_int.const_int(1_u64, false), len, "new_list_length"); // Allocate space for the new array that we'll copy into. 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 { builder.build_in_bounds_gep( clone_ptr, - &[ctx.i64_type().const_int(1_u64, false)], + &[env.ptr_int.const_int(1_u64, false)], "load_index", ) }; diff --git a/compiler/mono/src/reset_reuse.rs b/compiler/mono/src/reset_reuse.rs index 3a437e9d50..cb3db23427 100644 --- a/compiler/mono/src/reset_reuse.rs +++ b/compiler/mono/src/reset_reuse.rs @@ -247,8 +247,6 @@ fn insert_reset<'a>( let reset_expr = Expr::Reset(x); - // const I64: Layout<'static> = Layout::Builtin(crate::layout::Builtin::Int64); - let layout = Layout::Union(union_layout); stmt = env.arena.alloc(Stmt::Let(w, reset_expr, layout, stmt));