-
Notifications
You must be signed in to change notification settings - Fork 273
Implement natural loop rotation/canonicalization in GOTO programs #7211
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
Labels
Comments
It would greatly simplify our work on contracts. |
@diffblue/diffblue-opensource This tag might work where we cannot "assign" this to the Team. |
Just a note that #7321 might partially take care of this. |
I am scheduled to look at this issue once I finish my currently assigned task. |
This relates to #7518 My team has re-prioritised some of the work. I now have other documentation to write first. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CBMC version: 5.67.0
Operating system: N/A
Problem description
Let us consider a natural loop and the sequence of its instructions in the order in which they appear in the goto program.
The problem is that the sequence of loop instructions not necessarily densely packed in the goto program instruction sequence, meaning, the span of instructions between the first and the last loop instruction can contain instructions that are not part of the loop (typically, code that is only run once when breaking out of the loop)
This makes it difficult to apply loop transformations (in particular assigns clause instrumentation and loop contracts transformations), because these foreign instructions need to be preserved in the transformed loop.
LLVM loop canonicalisation could be a source of inspiration. loop canonicalisation ensures that loop instruction sequences are densely packed in the program's instruction sequence and that the loop has a single entry point and single exit point. The body of the loop can be swapped as a block, and code that needs to be hoisted out of the loop can safely be moved either to the single loop entry or the single loop exit location.
https://llvm.org/docs/LoopTerminology.html
https://llvm.org/devmtg/2009-10/ScalarEvolutionAndLoopOptimization.pdf
https://llvm.org/devmtg/2018-10/slides/Kruse-LoopTransforms.pdf
The text was updated successfully, but these errors were encountered: