mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
remove match cause build_eq can tell if it can't compare the BasicEnumValues
This commit is contained in:
parent
4f5237fcd8
commit
d880293afa
1 changed files with 38 additions and 48 deletions
|
@ -863,15 +863,12 @@ pub fn list_contains_help<'a, 'ctx, 'env>(
|
|||
elem: BasicValueEnum<'ctx>,
|
||||
elem_layout: &Layout<'a>,
|
||||
) -> BasicValueEnum<'ctx> {
|
||||
match (elem, elem_layout) {
|
||||
(BasicValueEnum::IntValue(_), _) => {
|
||||
let builder = env.builder;
|
||||
let ctx = env.context;
|
||||
|
||||
let bool_alloca = builder.build_alloca(ctx.bool_type(), "bool_alloca");
|
||||
let index_alloca = builder.build_alloca(ctx.i64_type(), "index_alloca");
|
||||
let next_free_index_alloca =
|
||||
builder.build_alloca(ctx.i64_type(), "next_free_index_alloca");
|
||||
let next_free_index_alloca = builder.build_alloca(ctx.i64_type(), "next_free_index_alloca");
|
||||
|
||||
builder.build_store(bool_alloca, ctx.bool_type().const_zero());
|
||||
builder.build_store(index_alloca, ctx.i64_type().const_zero());
|
||||
|
@ -892,8 +889,7 @@ pub fn list_contains_help<'a, 'ctx, 'env>(
|
|||
// loop body
|
||||
builder.position_at_end(body_bb);
|
||||
|
||||
let current_elem_ptr =
|
||||
unsafe { builder.build_in_bounds_gep(source_ptr, &[index], "elem_ptr") };
|
||||
let current_elem_ptr = unsafe { builder.build_in_bounds_gep(source_ptr, &[index], "elem_ptr") };
|
||||
|
||||
let current_elem = builder.build_load(current_elem_ptr, "load_elem");
|
||||
|
||||
|
@ -924,12 +920,6 @@ pub fn list_contains_help<'a, 'ctx, 'env>(
|
|||
|
||||
builder.build_load(bool_alloca, "answer")
|
||||
}
|
||||
_ => unreachable!(
|
||||
"Invalid element basic value enum or layout for List.contains : {:?}",
|
||||
(elem, elem_layout)
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
/// List.keepIf : List elem, (elem -> Bool) -> List elem
|
||||
pub fn list_keep_if<'a, 'ctx, 'env>(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue