-
Notifications
You must be signed in to change notification settings - Fork 274
Missed Optimization: memcpy(a,b,sizeof(*a))
is slower than *a = *b
#6846
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
Comments
Branch |
A bunch of questions/comments:
|
Sorry for the scanty feature request.
pub unsafe fn read<T>(src: [*const T](https://doc.rust-lang.org/std/primitive.pointer.html)) -> T It implements the logical operation result = *src; However, under the hood, it is implemented as When Kani was first written, we didn't have support for Rust intrinsics, so we used a |
|
Studying the example mentioned at the top, I am not entirely convinced that
|
Further investigation suggests that the root cause of those additional loops being triggered is constant propagation no longer taking place. This, in turn, is caused by the I will try to come up with a small example and will then try to implement additional simplification rules that make constant propagation possible again. |
Field sensitivity in goto symex updates the full object as well as individual fields for divisible objects. The updates of individual fields, however, previously used index or member expressions on that full object. Consequently, constant propagation was only possible when the full-object assignment had a constant as the right-hand side. In some cases, however, only parts of the whole object might be constant. We are now able to constant propagate the fields covering those (constant) parts. Fixes: diffblue#6846
#6856 improves the constant propagation, and makes the Kani test case complete without having to specify unwinding constraints. |
Field sensitivity in goto symex updates the full object as well as individual fields for divisible objects. The updates of individual fields, however, previously used index or member expressions on that full object. Consequently, constant propagation was only possible when the full-object assignment had a constant as the right-hand side. In some cases, however, only parts of the whole object might be constant. We are now able to constant propagate the fields covering those (constant) parts. Fixes: diffblue#6846
Field sensitivity in goto symex updates the full object as well as individual fields for divisible objects. The updates of individual fields, however, previously used index or member expressions on that full object. Consequently, constant propagation was only possible when the full-object assignment had a constant as the right-hand side. In some cases, however, only parts of the whole object might be constant. We are now able to constant propagate the fields covering those (constant) parts. Fixes: diffblue#6846
Field sensitivity in goto symex updates the full object as well as individual fields for divisible objects. The updates of individual fields, however, previously used index or member expressions on that full object. Consequently, constant propagation was only possible when the full-object assignment had a constant as the right-hand side. In some cases, however, only parts of the whole object might be constant. We are now able to constant propagate the fields covering those (constant) parts. Fixes: diffblue#6846
Field sensitivity in goto symex updates the full object as well as individual fields for divisible objects. The updates of individual fields, however, previously used index or member expressions on that full object. Consequently, constant propagation was only possible when the full-object assignment had a constant as the right-hand side. In some cases, however, only parts of the whole object might be constant. We are now able to constant propagate the fields covering those (constant) parts. Fixes: diffblue#6846
Field sensitivity in goto symex updates the full object as well as individual fields for divisible objects. The updates of individual fields, however, previously used index or member expressions on that full object. Consequently, constant propagation was only possible when the full-object assignment had a constant as the right-hand side. In some cases, however, only parts of the whole object might be constant. We are now able to constant propagate the fields covering those (constant) parts. Fixes: diffblue#6846
In branch https://github.com/danielsn/rmc/tree/test-use-memcpy-in-hook
cd tests/kani/Refs kani main.rs
If you run with the HEAD of the branch, the test is very slow; if you run with one commit before HEAD, its fast. The only change is to emit
memcpy(a,b,sizeof(*a))
vs*a = *b
.The text was updated successfully, but these errors were encountered: