Skip to content
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

Byte extract and extract bits can be constant #7331

Merged
merged 1 commit into from
Nov 28, 2022

Conversation

tautschnig
Copy link
Collaborator

When all operands are constants and the extract is fully within bounds of the source object then the result is constant.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@codecov
Copy link

codecov bot commented Nov 13, 2022

Codecov Report

Base: 78.34% // Head: 78.33% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (2ba7118) compared to base (a53fa0f).
Patch coverage: 89.51% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7331      +/-   ##
===========================================
- Coverage    78.34%   78.33%   -0.01%     
===========================================
  Files         1644     1645       +1     
  Lines       190313   190392      +79     
===========================================
+ Hits        149097   149153      +56     
- Misses       41216    41239      +23     
Impacted Files Coverage Δ
jbmc/src/janalyzer/janalyzer_parse_options.cpp 48.58% <ø> (ø)
.../src/java_bytecode/character_refine_preprocess.cpp 54.27% <ø> (ø)
...mc/src/java_bytecode/character_refine_preprocess.h 100.00% <ø> (ø)
jbmc/src/java_bytecode/ci_lazy_methods.h 100.00% <ø> (ø)
jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp 98.41% <ø> (ø)
jbmc/src/java_bytecode/ci_lazy_methods_needed.h 100.00% <ø> (ø)
jbmc/src/java_bytecode/code_with_references.cpp 84.61% <ø> (ø)
jbmc/src/java_bytecode/java_bmc_util.cpp 100.00% <ø> (ø)
...mc/src/java_bytecode/java_bytecode_convert_class.h 0.00% <ø> (ø)
...src/java_bytecode/java_bytecode_convert_method.cpp 97.69% <ø> (ø)
... and 420 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kroening
Copy link
Member

I'd be curious in which cases these are "considered constant" but not simplified to proper constants?

@tautschnig
Copy link
Collaborator Author

I'd be curious in which cases these are "considered constant" but not simplified to proper constants?

The case motivating this is turning a pointer into a sequence of bytes (as happens with memcpy).

@kroening
Copy link
Member

Independently, memcpy should become smarter.

@peterschrammel peterschrammel removed their assignment Nov 13, 2022
@tautschnig tautschnig added the Kani Bugs or features of importance to Kani Rust Verifier label Nov 13, 2022
@feliperodri feliperodri added the aws Bugs or features of importance to AWS CBMC users label Nov 14, 2022
When all operands are constants and the extract is fully within bounds
of the source object then the result is constant. This permits
constant-propagating byte-extract operations from pointers that are
address-of.
@kroening kroening merged commit ec85415 into diffblue:develop Nov 28, 2022
@tautschnig tautschnig deleted the feature/extract-constant branch November 28, 2022 19:52
tautschnig added a commit to tautschnig/cbmc that referenced this pull request Nov 28, 2022
With diffblue#7331 in combination with earlier changes to the simplifier the
left-hand side instance to check for now has a different SSA index.
As diffblue#7331 was not rebased on top of the simplifier changes, this went
unnoticed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users blocker Kani Bugs or features of importance to Kani Rust Verifier
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants