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-753] Change GEP style for array constraints #60

Conversation

0xddom
Copy link
Collaborator

@0xddom 0xddom commented Oct 17, 2023

No description provided.

@0xddom 0xddom requested a review from tim-hoffman October 17, 2023 14:00
Copy link

@tim-hoffman tim-hoffman left a comment

Choose a reason for hiding this comment

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

I left a few suggestions.

@@ -860,3 +860,18 @@ pub fn create_switch<'a>(
) -> InstructionValue<'a> {
producer.builder().build_switch(value, else_block, cases)
}

pub fn get_index_from_gep(gep: PointerValue) -> usize {
let op = gep

Choose a reason for hiding this comment

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

Maybe it should assert that gep has the GEP opcode.

Choose a reason for hiding this comment

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

Maybe also assert that operand 1 is 0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Putting a 0 as the first argument of a gep seems to be the standard, I would not worry too much about that, but Im adding the opcode check

Choose a reason for hiding this comment

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

That's exactly why I would add the assert. If some weird case ever appeared where it wasn't 0 for some reason, we would want to know.

code_producers/src/llvm_elements/instructions.rs Outdated Show resolved Hide resolved
@0xddom
Copy link
Collaborator Author

0xddom commented Oct 17, 2023

Looking at the failing test case I think this may not work with subcomponent signals but Im not sure yet

@0xddom
Copy link
Collaborator Author

0xddom commented Oct 17, 2023

Yeah, I'm creating GEPs from %0 when one of them should be from %6 (in this case)

Copy link

@tim-hoffman tim-hoffman left a comment

Choose a reason for hiding this comment

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

LGTM

@0xddom 0xddom merged commit e1d4a39 into llvm Oct 18, 2023
2 checks passed
@0xddom 0xddom deleted the dani/VAN-753-Change-GEP-style-for-constraint-signals-when-generating-array-constraints branch October 18, 2023 15:38
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