mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
skip is_null check if possible
This commit is contained in:
parent
9955fe581b
commit
7637506037
3 changed files with 32 additions and 2 deletions
|
@ -1165,7 +1165,12 @@ pub(crate) fn build_exp_expr<'a, 'ctx>(
|
|||
env.builder.position_at_end(check_if_null);
|
||||
|
||||
env.builder.build_conditional_branch(
|
||||
env.builder.build_is_null(tag_ptr, "is_tag_null"),
|
||||
// have llvm optimizations clean this up
|
||||
if layout_interner.is_nullable(layout) {
|
||||
env.builder.build_is_null(tag_ptr, "is_tag_null")
|
||||
} else {
|
||||
env.context.bool_type().const_int(false as _, false)
|
||||
},
|
||||
cont_block,
|
||||
check_if_unique,
|
||||
);
|
||||
|
@ -1246,7 +1251,12 @@ pub(crate) fn build_exp_expr<'a, 'ctx>(
|
|||
env.builder.position_at_end(check_if_null);
|
||||
|
||||
env.builder.build_conditional_branch(
|
||||
env.builder.build_is_null(tag_ptr, "is_tag_null"),
|
||||
// have llvm optimizations clean this up
|
||||
if layout_interner.is_nullable(layout) {
|
||||
env.builder.build_is_null(tag_ptr, "is_tag_null")
|
||||
} else {
|
||||
env.context.bool_type().const_int(false as _, false)
|
||||
},
|
||||
cont_block,
|
||||
check_if_unique,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue