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 56e675d
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 113 deletions.
113 changes: 39 additions & 74 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,82 +7,47 @@ on:
branches: [ main ]

jobs:
clippy:
runs-on: ubuntu-latest
build_with_vcpkg_installed_z3:
strategy:
matrix:
build: [windows] # [linux, macos, windows]
include:
# - build: linux
# os: ubuntu-latest
# vcpkg_triplet: x64-linux
# - build: macos
# os: macos-latest
# vcpkg_triplet: x64-osx
- build: windows
os: windows-latest
vcpkg_triplet: x64-windows-static-md
runs-on: ${{ matrix.os }}
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
steps:
- uses: actions/checkout@v3.5.2

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

steps:
- uses: actions/checkout@v3.5.2

- 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
- uses: actions/checkout@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: "lcov.info"

mirai_on_mirai_macos:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3.5.2

- 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/checkout@v3.5.2

- 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/checkout@v3.5.2

submodules: recursive
- name: Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
uses: KyleMayes/install-llvm-action@v1
if: matrix.os == 'windows-latest'
with:
version: "11.0"
directory: ${{ runner.temp }}/llvm
- name: Set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
if: matrix.os == 'windows-latest'
- run: echo Installing z3:${{ matrix.vcpkg_triplet }} on ${{ matrix.os }}.
- name: vcpkg build z3
uses: johnwason/vcpkg-action@v5
id: vcpkg
with:
pkgs: z3
triplet: ${{ matrix.vcpkg_triplet }}
cache-key: ${{ matrix.os }}
revision: master
token: ${{ github.token }}
extra-args: --clean-buildtrees-after-build
- name: Install MIRAI
run: |
cargo install --force --path ./checker
- name: Run MIRAI on MIRAI
run: |
cargo mirai --no-default-features
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vcpkg"]
path = vcpkg
url = git@github.com:microsoft/vcpkg.git
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
1 change: 1 addition & 0 deletions vcpkg
Submodule vcpkg added at 830f86

0 comments on commit 56e675d

Please sign in to comment.