From bb12b39fc750652c016d886dace8b52d03b48a11 Mon Sep 17 00:00:00 2001 From: Folkert Date: Fri, 22 Jan 2021 16:18:19 +0100 Subject: [PATCH] cleanup --- compiler/gen/src/llvm/refcounting.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/compiler/gen/src/llvm/refcounting.rs b/compiler/gen/src/llvm/refcounting.rs index 240eb5f67a..6d9e56ad5e 100644 --- a/compiler/gen/src/llvm/refcounting.rs +++ b/compiler/gen/src/llvm/refcounting.rs @@ -705,7 +705,7 @@ fn modify_refcount_str_help<'a, 'ctx, 'env>( IntPredicate::SGT, len, ptr_int(ctx, env.ptr_bytes).const_zero(), - "len > 0", + "is_big_str", ); // the block we'll always jump to when we're done @@ -928,10 +928,6 @@ fn build_rec_union_help<'a, 'ctx, 'env>( // next, make a jump table for all possible values of the tag_id let mut cases = Vec::with_capacity_in(tags.len(), env.arena); - let merge_block = env - .context - .append_basic_block(parent, pick("increment_merge", "decrement_merge")); - builder.set_current_debug_location(&context, loc); for (tag_id, field_layouts) in tags.iter().enumerate() { @@ -1052,18 +1048,22 @@ fn build_rec_union_help<'a, 'ctx, 'env>( // read the tag_id let current_tag_id = rec_union_read_tag(env, value_ptr); + let merge_block = env + .context + .append_basic_block(parent, pick("increment_merge", "decrement_merge")); + // switch on it env.builder .build_switch(current_tag_id, merge_block, &cases); + + env.builder.position_at_end(merge_block); + + // increment/decrement the cons-cell itself + refcount_ptr.modify(call_mode, &layout, env); + + // this function returns void + builder.build_return(None); } - - env.builder.position_at_end(merge_block); - - // increment/decrement the cons-cell itself - refcount_ptr.modify(call_mode, &layout, env); - - // this function returns void - builder.build_return(None); } fn rec_union_read_tag<'a, 'ctx, 'env>(