Skip to content

Commit

Permalink
Remove clone
Browse files Browse the repository at this point in the history
  • Loading branch information
iangneal committed Oct 11, 2023
1 parent e8ba2ed commit c2fc762
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions compiler/src/intermediate_representation/constraint_bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,23 +150,24 @@ impl WriteLLVMIR for ConstraintBucket {
assert_eq!(bigint_type(producer).ptr_type(Default::default()), lhs_ptr.get_type(), "wrong type");
let rhs_ptr = get_instruction_arg(prev.into_instruction_value(), STORE_SRC_IDX).into_pointer_value();

let constraint_calls: Vec<_> = (0..size).map(|i| {
let mut last_call = None;
for i in 0..size {
let idx = create_literal_u32(producer, i as u64);
let lhs = create_load(producer, create_gep(producer, lhs_ptr, &[idx]).into_pointer_value());
let rhs = create_load(producer, create_gep(producer, rhs_ptr, &[idx]).into_pointer_value());
let constr = new_constraint_with_name(producer, format!("constraint_{}", i).as_str());
create_call(
last_call = Some(create_call(
producer,
CONSTRAINT_VALUES_FN_NAME,
&[
to_basic_metadata_enum(lhs),
to_basic_metadata_enum(rhs),
to_basic_metadata_enum(constr),
],
)
}).collect();
));
}

Some(constraint_calls.last().expect("must have >1 value!").clone())
last_call
}

}
Expand Down

0 comments on commit c2fc762

Please sign in to comment.