-
Notifications
You must be signed in to change notification settings - Fork 273
Partial expression simplification #1020
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
Partial expression simplification #1020
Conversation
…be picked independently.
The option string --show --intervals is more flexible, --show-intervals is now an alias.
This includes skeleton code written by @martin-cs. Added hook for running the variable sensitivity Involved removing messaget inheritance since we require a zero parameter constructor for ai_baset Terminate correctly Made the domain correclty find the fixed point. The merge operation returns whether the merge actually changed any values by implementing a operator== for each of the abstract objects. Further, when merging a map, if a key is absent from one map then we remove it from the other unless the map is bottom. Adding handlers for the special types They are just stubs at the moment, returning top as we need the abstract objects that represent them. Updated interface for ai_domain_baset
Modify the merge to return shared pointers by replacing returns of this with returns of `shared_from_this`. This simplifies the code for dealing with when need to modify the result in dervied classes as we are no longer responsible for freeing the pointer returned by the super class.
The base merge should always result in either top or bottom (it is up for dervied classes to clear the top flag if they are not top). Correctly use the base class merge when appropriate in merging constant values.
Refactored the merge maps method to use std::intersection as there was a bug with empty maps caught by the unit tests.
Use the CPROVER_assert as behaviour is consistent across platforms.
Removed some unnecessary debug information from the tests
In release builds, the top/bottom status of the enviroment was undefined. This ensures the enviroment is set to top (i.e. an entry point).
Previously each abstract object that implemented merge had to correctly redirect merging top with anything or merging with a bottom. This is now handled directly in the root merge by checking the three cases where the base merge must be used. If this is bottom must still be handled by derived classes as we must create an abstract object of the same type.
At some point this commit needs backdating as the ai_domain interface has changed under our feet.
Looks good to me. The only nit is to make sure to update the call to ai_simplify to the new signature. |
Let's see if the merge issues go away once the rebase is done. Other than that I am happy with this change. |
If the ai_simplify is not able to resolve the expression to a constant, it tries to simplify recursively any child operations. For example, given a int i that is know to be 1, and an unknown (top) array a, it would convert a[i] to a[1].
9f2198a
to
de2f979
Compare
Closing as it's unlike @thk123 is going to pick this up again. Also I believe a version of this was eventually implemented regardless. |
Just to close the loop, VSD did get merged and @jezhiggins is currently working on this bit of code, hopefully for a final version. |
Depends on variable sensitivity domain: #708
Fixes part of diffblue/cbmc-toyota#132
When calling
ai_simplify
, previously if we couldn't simplify the whole expression we gave up. Now werecurse over the sub-elements to get a partially simplified expression. E.g. if we have an array whose value is top, but the index
i
is known to be 1 thenarr[i]
will simplify to:Real diff: de2f979