undid inlining

This commit is contained in:
J.Teeuwissen 2023-04-15 17:41:10 +02:00
parent 3c5a978bbe
commit 9d4c3bcfb9
No known key found for this signature in database
GPG key ID: DB5F7A1ED8D478AD
5 changed files with 61 additions and 100 deletions

View file

@ -1502,28 +1502,10 @@ pub fn build_num_binop<'a, 'ctx, 'env>(
rhs_layout: InLayout<'a>,
op: LowLevel,
) -> BasicValueEnum<'ctx> {
// Recursively getting the lambdaset runtime representation
// as inlining lowlevels in RC might cause the layout to not to match the lowlevel args.
// Originally, the wrapper function received the mismatching layout but this was not validated.
let mut lhs_inlayout = lhs_layout;
let lhs_interned = loop {
let lhs_interned = layout_interner.get(lhs_inlayout);
match lhs_interned {
Layout::LambdaSet(lambda) => lhs_inlayout = lambda.runtime_representation(),
other => break other,
};
};
let mut rhs_inlayout = lhs_layout;
let rhs_interned = loop {
let rhs_interned = layout_interner.get(rhs_inlayout);
match rhs_interned {
Layout::LambdaSet(lambda) => rhs_inlayout = lambda.runtime_representation(),
other => break other,
};
};
match (lhs_interned, rhs_interned) {
match (
layout_interner.get(lhs_layout),
layout_interner.get(rhs_layout),
) {
(Layout::Builtin(lhs_builtin), Layout::Builtin(rhs_builtin))
if lhs_builtin == rhs_builtin =>
{