-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Don't use operands as range analysis SSA variables #14720
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
Conversation
…the modulus analysis nonterminating on our tests, but we'll fix that in the next commit.
|
Something looks potentially a bit off. This is just based on a cursory glance, but based on the qldoc fo |
Thanks for the comments. I think the QLDoc is slightly misleading. Let me try to give some more context:
because:
|
|
In this case it works, because the inexact operand is coming from the I think the phi node will end up with upper and lower bounds of |
|
Hmm... But isn't that the behavior we'd get anyway on I'm not even sure we support |
|
So I think that, if anything is wrong on this PR, then I think it'll also be wrong currently on |
|
I had a good discussion with @aschackmull about this PR on Zoom today, and we came to roughly the same conclusion as you @rdmarsh2. Schack will open an alternative PR (that keeps inexact operands as SSA variables) which will supersede this one. |
This PR gets rid of operands as SSA variables for range analysis. Merely removing those SSA variables causes nontermination on Wireshark, and in a previous PR I reduced the issue to the snippet:
the problem is the
PhiInstructionbefore the entry to thewhileloop that merges the incoming edge from (1)x->n--and from (2) the initial value ofxat the entry point of the function. The second operand of thatPhiInstructionis an inexact operand which means that the IR has deduced that it's not guaranteed that the entire operand will be consumed by thePhiInstruction. This can be seen by the~prefix on the operand in the IR for the above:And when one uses the
getAnInput()predicate onPhiInstructions, only the exact operands are returned. So we were missing the phi input at this edge, and this made the modulus analysis nonterminating.This PR fixes this by replacing
getAnInput()withgetAnOperand().getAnyDef(). This means we'll include those inexact operands as well.Commit-by-commit review recommended: