Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VAN-545] extract loop body to separate function before unrolling #52

Merged
merged 43 commits into from
Oct 18, 2023

Conversation

tim-hoffman
Copy link

No description provided.

@tim-hoffman tim-hoffman self-assigned this Sep 6, 2023
@tim-hoffman tim-hoffman changed the title [VAN-547] extract loop body to separate function before unrolling [VAN-547][VAN-609] extract loop body to separate function before unrolling Sep 6, 2023
@tim-hoffman tim-hoffman changed the title [VAN-547][VAN-609] extract loop body to separate function before unrolling [VAN-547][VAN-605][VAN-609] extract loop body to separate function before unrolling Sep 21, 2023
@tim-hoffman tim-hoffman changed the title [VAN-547][VAN-605][VAN-609] extract loop body to separate function before unrolling [VAN-545] extract loop body to separate function before unrolling Sep 25, 2023
@tim-hoffman tim-hoffman marked this pull request as ready for review October 4, 2023 18:57
Copy link
Collaborator

@0xddom 0xddom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think I get the general idea of the algorithms you have been using to do the extraction and looks good to me. I mostly commented about commented out code that we should remove if its no longer useful and a couple minor details.

circuit_passes/src/passes/simplification.rs Outdated Show resolved Hide resolved
code_producers/src/llvm_elements/functions.rs Outdated Show resolved Hide resolved
Comment on lines 90 to 107
let get_ptr = || {
let arr_ptr = match &self.address_type {
AddressType::Variable => producer.body_ctx().get_variable_array(producer),
AddressType::Signal => producer.template_ctx().get_signal_array(producer),
AddressType::SubcmpSignal { cmp_address, counter_override, .. } => {
let addr = cmp_address.produce_llvm_ir(producer)
.expect("The address of a subcomponent must yield a value!");
if *counter_override {
return producer.template_ctx().load_subcmp_counter(producer, addr)
} else {
let subcmp = producer.template_ctx().load_subcmp_addr(producer, addr);
create_gep(producer, subcmp, &[zero(producer)])
}
}
};
pointer_cast(producer, arr_ptr.into_pointer_value(), array_ptr_ty(producer))
};
create_call(producer, name.as_str(), &[get_ptr().into(), index.into()])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a closure here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I could do an early return for the counter_override case :)

code_producers/src/llvm_elements/template.rs Show resolved Hide resolved
compiler/src/intermediate_representation/store_bucket.rs Outdated Show resolved Hide resolved
@0xddom
Copy link
Collaborator

0xddom commented Oct 11, 2023

And sorry for 29 comments all of a sudden

@tim-hoffman tim-hoffman merged commit 7150c67 into llvm Oct 18, 2023
4 checks passed
@tim-hoffman tim-hoffman deleted the th/loop-body-extraction branch October 18, 2023 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants