Skip to content

Commit d44819f

Browse files
authored
Get rid of the legacy mode (#2427)
Get rid of the Legacy mode and modify the std regression. Since we produce goto now directly, we can afford using `pub_fns`. There's just a small performance penalty.
1 parent 6bc2e38 commit d44819f

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

kani-compiler/kani_queries/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ use strum_macros::{AsRefStr, EnumString, EnumVariantNames};
99
pub enum ReachabilityType {
1010
/// Start the cross-crate reachability analysis from all harnesses in the local crate.
1111
Harnesses,
12-
/// Use standard rustc monomorphizer algorithm.
13-
Legacy,
1412
/// Don't perform any reachability analysis. This will skip codegen for this crate.
1513
#[default]
1614
None,

kani-compiler/src/codegen_cprover_gotoc/compiler_interface.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use rustc_hir::def_id::LOCAL_CRATE;
3030
use rustc_metadata::fs::{emit_wrapper_file, METADATA_FILENAME};
3131
use rustc_metadata::EncodedMetadata;
3232
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
33-
use rustc_middle::mir::mono::{CodegenUnit, MonoItem};
33+
use rustc_middle::mir::mono::MonoItem;
3434
use rustc_middle::mir::write_mir_pretty;
3535
use rustc_middle::ty::query::Providers;
3636
use rustc_middle::ty::{self, InstanceDef, TyCtxt};
@@ -400,15 +400,6 @@ fn collect_codegen_items<'tcx>(gcx: &GotocCtx<'tcx>) -> Vec<MonoItem<'tcx>> {
400400
let reach = gcx.queries.get_reachability_analysis();
401401
debug!(?reach, "collect_codegen_items");
402402
match reach {
403-
ReachabilityType::Legacy => {
404-
// Use rustc monomorphizer to retrieve items to codegen.
405-
let codegen_units: &'tcx [CodegenUnit<'_>] = tcx.collect_and_partition_mono_items(()).1;
406-
codegen_units
407-
.iter()
408-
.flat_map(|cgu| cgu.items_in_deterministic_order(tcx))
409-
.map(|(item, _)| item)
410-
.collect()
411-
}
412403
ReachabilityType::Harnesses => {
413404
// Cross-crate collecting of all items that are reachable from the crate harnesses.
414405
let harnesses = filter_crate_items(tcx, |_, def_id| is_proof_harness(gcx.tcx, def_id));

scripts/kani-regression.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ for testp in "${TESTS[@]}"; do
6969
--quiet --no-fail-fast
7070
done
7171

72-
# Check codegen for the standard library
73-
time "$SCRIPT_DIR"/std-lib-regression.sh
72+
# Don't run std regression if using JSON symtab to avoid OOM issues.
73+
if [[ -z "${KANI_ENABLE_WRITE_JSON_SYMTAB-}" ]]; then
74+
# Check codegen for the standard library
75+
time "$SCRIPT_DIR"/std-lib-regression.sh
76+
fi
7477

7578
# We rarely benefit from re-using build artifacts in the firecracker test,
7679
# and we often end up with incompatible leftover artifacts:

scripts/std-lib-regression.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ export RUSTC_LOG=error
7070
RUST_FLAGS=(
7171
"--kani-compiler"
7272
"-Cpanic=abort"
73+
"-Zalways-encode-mir"
7374
"-Cllvm-args=--goto-c"
7475
"-Cllvm-args=--ignore-global-asm"
75-
"-Cllvm-args=--reachability=legacy"
76+
"-Cllvm-args=--reachability=pub_fns"
7677
)
7778
export RUSTFLAGS="${RUST_FLAGS[@]}"
7879
export RUSTC="$KANI_DIR/target/kani/bin/kani-compiler"

0 commit comments

Comments
 (0)