Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Make simplification with TOP more aggressive
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanventer committed Oct 23, 2023
1 parent 9b2ceeb commit 40bff4d
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 109 deletions.
83 changes: 13 additions & 70 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,82 +7,25 @@ on:
branches: [ main ]

jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- name: Run Clippy
run: |
cargo clippy --no-default-features --all-targets -- -D warnings
tests:
runs-on: macos-latest

steps:
- uses: actions/[email protected]

- name: Execute tests
run: |
cargo test --all -- --test-threads=1
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests"

- name: Setup grcov
run: |
cargo install grcov
- name: Run grcov
run: |
zip -0 cov.zip $(find . -name "mirai*.gc*" -print)
grcov cov.zip -s . -t lcov --llvm --ignore-not-existing --ignore "/*" -o lcov.info
- name: Upload coverage data to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: "lcov.info"

mirai_on_mirai_macos:
runs-on: macos-latest

steps:
- uses: actions/[email protected]

- name: Install MIRAI
run: |
cargo install --force --path ./checker --no-default-features
- name: Run MIRAI on MIRAI
run: |
cargo mirai --no-default-features
mirai_on_mirai_ubuntu:
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]

- name: Install MIRAI
run: |
cargo install --force --path ./checker
- name: Run MIRAI on MIRAI
run: |
cargo mirai --no-default-features
mirai_on_mirai_windows:
runs-on: windows-latest

steps:
- uses: actions/[email protected]
- uses: lukka/get-cmake@latest
- name: List $RUNNER_WORKSPACE before vcpkg is setup
run: find $RUNNER_WORKSPACE
shell: bash

- name: Setup vcpkg
uses: lukka/run-vcpkg@main
id: runvcpkg
with:
# This one is not needed, as it is the default value anyway.
# vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgJsonGlob: '**/cmakepresets/vcpkg.json'
vcpkgCommitId: 'c9f906558f9bb12ee9811d6edc98ec9255c6cda5'

- name: Install MIRAI
run: |
cargo install --force --path ./checker
- name: Run MIRAI on MIRAI
run: |
cargo mirai --no-default-features
57 changes: 22 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified binaries/summary_store.tar
Binary file not shown.
2 changes: 1 addition & 1 deletion checker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ shellwords = "*"
sled = "*"
tar = "0.4.38"
tempfile = "*"
z3-sys = { version = "*", features = ["static-link-z3"], optional = true }
z3-sys = { version = "*", git="https://github.com/prove-rs/z3.rs.git", features = ["vcpkg"], optional = true }

[dev-dependencies]
walkdir = "*"
Expand Down
6 changes: 5 additions & 1 deletion checker/src/abstract_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3416,7 +3416,11 @@ impl AbstractValueTrait for Rc<AbstractValue> {
/// True if all possible concrete values are elements of the set corresponding to this domain.
#[logfn_inputs(TRACE)]
fn is_top(&self) -> bool {
matches!(&self.expression, Expression::Top)
match &self.expression {
Expression::Top => true,
Expression::Variable { path, .. } => path.is_top(),
_ => false,
}
}

/// True if this value is an empty tuple, which is the sole value of the unit type.
Expand Down
3 changes: 2 additions & 1 deletion checker/src/body_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> {
return environment;
}
trace!("def_id {:?}", self.tcx.def_kind(self.def_id));
let saved_type_visitor = self.type_visitor.clone();
let saved_mir = self.mir;
let saved_def_id = self.def_id;
for (ordinal, constant_mir) in self.tcx.promoted_mir(self.def_id).iter().enumerate() {
Expand Down Expand Up @@ -917,7 +918,7 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> {
}
self.def_id = saved_def_id;
self.mir = saved_mir;
self.type_visitor_mut().mir = saved_mir;
*self.type_visitor_mut() = saved_type_visitor;
environment
}

Expand Down
7 changes: 7 additions & 0 deletions checker/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,13 @@ impl Path {
}
}

pub fn is_top(&self) -> bool {
match &self.value {
PathEnum::Computed { value } => value.is_top(),
_ => false,
}
}

// Returns the length of the path.
#[logfn_inputs(TRACE)]
pub fn path_length(&self) -> usize {
Expand Down
1 change: 1 addition & 0 deletions checker/src/type_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ impl<'tcx> TypeCache<'tcx> {
}
}

#[derive(Clone)]
pub struct TypeVisitor<'tcx> {
pub actual_argument_types: Vec<Ty<'tcx>>,
pub closures_being_specialized: RefCell<HashSet<DefId>>,
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/run-pass/transmute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub unsafe fn t6() {
let arr_ptr = std::mem::transmute::<&[i32], *const [i32]>(arr_ref);
let fat_ptr = std::mem::transmute::<*const [i32], FatPtr<i32>>(arr_ptr);
verify!(fat_ptr.fat == 3);
verify!(*fat_ptr.ptr == 1);
verify!(*fat_ptr.ptr == 1); //~ possible false verification condition
}

pub unsafe fn t7() {
Expand Down

0 comments on commit 40bff4d

Please sign in to comment.