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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++: Remove rank aggregate in SsaInternals
#7525
Conversation
鈥y a rank computation anymore.
| cached | ||
| final predicate hasRankInBlock(IRBlock block, int rnk) { rnk = getRank(this, block) } | ||
| /** Holds if this definition or use has index `index` in block `block`. */ | ||
| final predicate hasIndexInBlock(IRBlock block, int index) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OOI: Why has the cached annotation been removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The annotation was there to force the work done by getRank to be cached, but the new predicate uses the IRBlock::getInstruction member predicate, which itself uses a cached nonmember getInstruction predicate. Those predicates will all have the same contents and column order, so in practice any use of hasIndexInBlock will use the cached getInstruction directly.
| cached | ||
| final predicate hasRankInBlock(IRBlock block, int rnk) { rnk = getRank(this, block) } | ||
| /** Holds if this definition or use has index `index` in block `block`. */ | ||
| final predicate hasIndexInBlock(IRBlock block, int index) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, hasRankInBlock could only hold for rnk \in [1, ...] because it delegates to getRank which uses a rank aggregate (and rank aggregates start at 1).
But hasIndexInBlock will now also hold for index in [0, ...] because it delegates to block.getInstruction which is zero-based I assume.
Isn't this a behavior change or is rnk/index only used transparently and so this does not matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. This isn't completely behavior preserving, but all current uses of this predicate shouldn't depend on this change for the exact reason that you mentioned :)


This is hopefully a behavior-preserving optimization馃 .
Thanks to @hvitved for suggesting this.
The text was updated successfully, but these errors were encountered: