A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Remove indicatif dependency from bugpoint (#12048)
Alex Crichtone5aa9983451f
diff --git a/Cargo.lock b/Cargo.lockindex c156f405b4..a01b8a6ec0 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -653,19 +653,6 @@ dependencies = ["quote",]-[[package]]-name = "console"-version = "0.16.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b430743a6eb14e9764d4260d4c0d8123087d504eeb9c48f2b2a5e810dd369df4"-dependencies = [- "encode_unicode",- "libc",- "once_cell",- "unicode-width 0.2.0",- "windows-sys 0.61.2",-]-[[package]]name = "constant_time_eq"version = "0.1.5"@@ -1009,7 +996,6 @@ dependencies = ["cranelift-reader","env_logger 0.11.5","filecheck",- "indicatif","log","pulley-interpreter","rayon",@@ -1246,12 +1232,6 @@ dependencies = ["wasmtime-wasi-io",]-[[package]]-name = "encode_unicode"-version = "1.0.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"-[[package]]name = "encoding_rs"version = "0.8.31"@@ -2030,18 +2010,6 @@ dependencies = ["serde_core",]-[[package]]-name = "indicatif"-version = "0.13.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8572bccfb0665e70b7faf44ee28841b8e0823450cd4ad562a76b5a3c4bf48487"-dependencies = [- "console",- "lazy_static",- "number_prefix",- "regex",-]-[[package]]name = "inout"version = "0.1.3"@@ -2519,12 +2487,6 @@ dependencies = ["libc",]-[[package]]-name = "number_prefix"-version = "0.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a"-[[package]]name = "object"version = "0.36.5"diff --git a/cranelift/Cargo.toml b/cranelift/Cargo.tomlindex 8550082f6b..055c979837 100644--- a/cranelift/Cargo.toml+++ b/cranelift/Cargo.toml@@ -40,7 +40,6 @@ capstone = { workspace = true, optional = true }target-lexicon = { workspace = true, features = ["std"] }env_logger = { workspace = true }rayon = { version = "1", optional = true }-indicatif = "0.13.0"thiserror = { workspace = true }walkdir = { workspace = true }anyhow = { workspace = true }diff --git a/cranelift/src/bugpoint.rs b/cranelift/src/bugpoint.rsindex ed5546b6b9..d4d1501042 100644--- a/cranelift/src/bugpoint.rs+++ b/cranelift/src/bugpoint.rs@@ -15,7 +15,6 @@ use cranelift_codegen::ir::{use cranelift_codegen::isa::TargetIsa;use cranelift_entity::PrimaryMap;use cranelift_reader::{ParseOptions, parse_sets_and_triple, parse_test};-use indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle};use std::collections::HashMap;use std::path::PathBuf;@@ -96,7 +95,6 @@ enum ProgressStatus {trait Mutator {fn name(&self) -> &'static str;- fn mutation_count(&self, func: &Function) -> usize;fn mutate(&mut self, func: Function) -> Option<(Function, String, ProgressStatus)>;/// Gets called when the returned mutated function kept on causing the crash. This can be used@@ -126,10 +124,6 @@ impl Mutator for RemoveInst {"remove inst"}- fn mutation_count(&self, func: &Function) -> usize {- inst_count(func)- }-fn mutate(&mut self, mut func: Function) -> Option<(Function, String, ProgressStatus)> {next_inst_ret_prev(&func, &mut self.block, &mut self.inst).map(|(prev_block, prev_inst)| {func.layout.remove_inst(prev_inst);@@ -167,10 +161,6 @@ impl Mutator for ReplaceInstWithConst {"replace inst with const"}- fn mutation_count(&self, func: &Function) -> usize {- inst_count(func)- }-fn mutate(&mut self, mut func: Function) -> Option<(Function, String, ProgressStatus)> {next_inst_ret_prev(&func, &mut self.block, &mut self.inst).map(|(_prev_block, prev_inst)| {@@ -261,10 +251,6 @@ impl Mutator for ReplaceInstWithTrap {"replace inst with trap"}- fn mutation_count(&self, func: &Function) -> usize {- inst_count(func)- }-fn mutate(&mut self, mut func: Function) -> Option<(Function, String, ProgressStatus)> {next_inst_ret_prev(&func, &mut self.block, &mut self.inst).map(|(_prev_block, prev_inst)| {@@ -302,10 +288,6 @@ impl Mutator for MoveInstToEntryBlock {"move inst to entry block"}- fn mutation_count(&self, func: &Function) -> usize {- inst_count(func)- }-fn mutate(&mut self, mut func: Function) -> Option<(Function, String, ProgressStatus)> {next_inst_ret_prev(&func, &mut self.block, &mut self.inst).map(|(prev_block, prev_inst)| {// Don't move instructions that are already in entry block@@ -350,10 +332,6 @@ impl Mutator for RemoveBlock {"remove block"}- fn mutation_count(&self, func: &Function) -> usize {- block_count(func)- }-fn mutate(&mut self, mut func: Function) -> Option<(Function, String, ProgressStatus)> {func.layout.next_block(self.block).map(|next_block| {self.block = next_block;@@ -391,13 +369,6 @@ impl Mutator for ReplaceBlockParamWithConst {"replace block parameter with const"}- fn mutation_count(&self, func: &Function) -> usize {- func.layout- .blocks()- .map(|block| func.dfg.num_block_params(block))- .sum()- }-fn mutate(&mut self, mut func: Function) -> Option<(Function, String, ProgressStatus)> {while self.params_remaining == 0 {self.block = func.layout.next_block(self.block)?;@@ -461,10 +432,6 @@ impl Mutator for RemoveUnusedEntities {"remove unused entities"}- fn mutation_count(&self, _func: &Function) -> usize {- 4- }-fn mutate(&mut self, mut func: Function) -> Option<(Function, String, ProgressStatus)> {let name = match self.kind {0 => {@@ -682,11 +649,6 @@ impl Mutator for MergeBlocks {"merge blocks"}- fn mutation_count(&self, func: &Function) -> usize {- // N blocks may result in at most N-1 merges.- block_count(func) - 1- }-fn mutate(&mut self, mut func: Function) -> Option<(Function, String, ProgressStatus)> {let block = match func.layout.next_block(self.block) {Some(block) => block,@@ -852,11 +814,6 @@ fn reduce(isa: &dyn TargetIsa, mut func: Function, verbose: bool) -> Result<(Funtry_resolve_aliases(&mut context, &mut func);try_remove_srclocs(&mut context, &mut func);- let progress_bar = ProgressBar::with_draw_target(0, ProgressDrawTarget::stdout());- progress_bar.set_style(- ProgressStyle::default_bar().template("{bar:60} {prefix:40} {pos:>4}/{len:>4} {msg}"),- );-for pass_idx in 0..100 {let mut should_keep_reducing = false;let mut phase = 0;@@ -874,16 +831,9 @@ fn reduce(isa: &dyn TargetIsa, mut func: Function, verbose: bool) -> Result<(Fun_ => break,};- progress_bar.set_prefix(&format!("pass {} phase {}", pass_idx, mutator.name()));- progress_bar.set_length(mutator.mutation_count(&func) as u64);-- // Reset progress bar.- progress_bar.set_position(0);- progress_bar.set_draw_delta(0);+ println!("pass {} phase {}", pass_idx, mutator.name());for _ in 0..10000 {- progress_bar.inc(1);-let (mutated_func, msg, mutation_kind) = match mutator.mutate(func.clone()) {Some(res) => res,None => {@@ -897,8 +847,6 @@ fn reduce(isa: &dyn TargetIsa, mut func: Function, verbose: bool) -> Result<(Funcontinue;}- progress_bar.set_message(&msg);-match context.check_for_crash(&mutated_func) {CheckResult::Succeed => {// Mutating didn't hit the problem anymore, discard changes.@@ -920,7 +868,7 @@ fn reduce(isa: &dyn TargetIsa, mut func: Function, verbose: bool) -> Result<(FunProgressStatus::Skip => unreachable!(),};if verbose {- progress_bar.println(format!("{msg}: {verb}"));+ println!("{msg}: {verb}");}}}@@ -929,7 +877,7 @@ fn reduce(isa: &dyn TargetIsa, mut func: Function, verbose: bool) -> Result<(Funphase += 1;}- progress_bar.println(format!(+ println!("After pass {}, remaining insts/blocks: {}/{} ({})",pass_idx,inst_count(&func),@@ -939,7 +887,7 @@ fn reduce(isa: &dyn TargetIsa, mut func: Function, verbose: bool) -> Result<(Fun} else {"stop reducing"}- ));+ );if !should_keep_reducing {// No new shrinking opportunities have been found this pass. This means none will ever@@ -949,7 +897,6 @@ fn reduce(isa: &dyn TargetIsa, mut func: Function, verbose: bool) -> Result<(Fun}try_resolve_aliases(&mut context, &mut func);- progress_bar.finish();let crash_msg = match context.check_for_crash(&func) {CheckResult::Succeed => unreachable!("Used to crash, but doesn't anymore???"),