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

Brodes/guard flow parsing #17907

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

bdrodes
Copy link
Contributor

@bdrodes bdrodes commented Nov 4, 2024

No description provided.

@github-actions github-actions bot added the C++ label Nov 4, 2024
Comment on lines 16 to 18
result = valueNumber(instr).getAnInstruction() and
result.toString() != instr.toString() and
result instanceof CompareInstruction
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't want to use toString when implementing query/library logic. toString output is being changed consistently to provide better UX in query output without any deprecation periods, and there shouldn't be any hidden invariants in the output of these predicates. So we need to come up with something else here.

What's the job of this predicate really? I think you're trying to find an equivalent instruction that performs a comparison so that we can derive guards from that comparison instead of the original instruction, right? But why should we restrict that to be CompareInstructions only? And why check that they have a different toString? If it's because we want to not have result = instr in this case could we not simply write result != instr?

And related to the QLDoc: What do you mean by "define" instr? I think we should have an example in the QLDoc to motivate this predicate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll take the discussion offline. But some quick comments:

  • Agreed on tostring, but I don't know a better approach, we will discuss
  • I can't say result != instr because that's not what I'm trying to achieve here. I'm trying to not get other GVN instructions that are identical. e.g., a->foo->bar I don't need to get every a->foo->bar, I need to get the instruction that defines a->foo->bar and ignore everything else. I'm playing a game with GVN to give me the SSA def. We probably need to use SSA instead, but this was a quick demonstration of how to get what I wanted (it at least works with the AST version of this in my tests in the past)
  • I only limited CompareInstruction because I thought I saw you were doing the same, but I've been testing with and without it.
  • The TLDR for me is either we use SSA, or keep this kind of approach but use the IR to help me find only the GVN with the definition. I'm no expert on the syntax of all the different IR instruction types, but perhaps you can provide some guidance.

Taking further discussion into a DM until we settle on a few things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants