mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Merge pull request #7317 from roc-lang/ayaz/fix-pass-by-reference
Fix pass by reference for compare fn
This commit is contained in:
commit
f0cc363b53
1 changed files with 12 additions and 7 deletions
|
@ -12,8 +12,8 @@ use crate::llvm::refcounting::{
|
||||||
use inkwell::attributes::{Attribute, AttributeLoc};
|
use inkwell::attributes::{Attribute, AttributeLoc};
|
||||||
use inkwell::types::{BasicType, BasicTypeEnum, StructType};
|
use inkwell::types::{BasicType, BasicTypeEnum, StructType};
|
||||||
use inkwell::values::{
|
use inkwell::values::{
|
||||||
BasicValue, BasicValueEnum, CallSiteValue, FunctionValue, InstructionValue, IntValue,
|
BasicMetadataValueEnum, BasicValue, BasicValueEnum, CallSiteValue, FunctionValue,
|
||||||
PointerValue, StructValue,
|
InstructionValue, IntValue, PointerValue, StructValue,
|
||||||
};
|
};
|
||||||
use inkwell::AddressSpace;
|
use inkwell::AddressSpace;
|
||||||
use roc_error_macros::internal_error;
|
use roc_error_macros::internal_error;
|
||||||
|
@ -726,13 +726,18 @@ pub fn build_compare_wrapper<'a, 'ctx>(
|
||||||
"load_opaque",
|
"load_opaque",
|
||||||
);
|
);
|
||||||
|
|
||||||
let closure_data =
|
let closure_data: BasicMetadataValueEnum =
|
||||||
env.builder
|
if layout_interner.is_passed_by_reference(closure_data_repr) {
|
||||||
.new_build_load(closure_type, closure_cast, "load_opaque");
|
closure_cast.into()
|
||||||
|
} else {
|
||||||
|
env.builder
|
||||||
|
.new_build_load(closure_type, closure_cast, "load_opaque")
|
||||||
|
.into()
|
||||||
|
};
|
||||||
|
|
||||||
env.arena
|
env.arena
|
||||||
.alloc([value1.into(), value2.into(), closure_data.into()])
|
.alloc([value1.into(), value2.into(), closure_data])
|
||||||
as &[_]
|
as &[BasicMetadataValueEnum]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue