We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3df5dfb commit d4dd238Copy full SHA for d4dd238
cranelift/fuzzgen/src/config.rs
@@ -1,3 +1,4 @@
1
+use std::collections::HashMap;
2
use std::ops::RangeInclusive;
3
4
/// Holds the range of acceptable values to use during the generation of testcases
@@ -54,6 +55,11 @@ pub struct Config {
54
55
/// We insert a checking sequence to guarantee that those inputs never make
56
/// it to the instruction, but sometimes we want to allow them.
57
pub allowed_fcvt_traps_ratio: (usize, usize),
58
+
59
+ /// Some flags really impact compile performance, we still want to test
60
+ /// them, but probably at a lower rate, so that overall execution time isn't
61
+ /// impacted as much
62
+ pub compile_flag_ratio: HashMap<&'static str, (usize, usize)>,
63
}
64
65
impl Default for Config {
@@ -79,6 +85,7 @@ impl Default for Config {
79
85
backwards_branch_ratio: (1, 1000),
80
86
allowed_int_divz_ratio: (1, 1_000_000),
81
87
allowed_fcvt_traps_ratio: (1, 1_000_000),
88
+ compile_flag_ratio: [("regalloc_checker", (1usize, 100))].into_iter().collect(),
82
89
83
90
84
91
cranelift/fuzzgen/src/lib.rs
@@ -257,7 +257,14 @@ where
257
"enable_llvm_abi_extensions",
258
];
259
for flag_name in bool_settings {
260
- let value = format!("{}", bool::arbitrary(self.u)?);
+ let enabled = self
261
+ .config
262
+ .compile_flag_ratio
263
+ .get(&flag_name)
264
+ .map(|&(num, denum)| self.u.ratio(num, denum))
265
+ .unwrap_or_else(|| bool::arbitrary(self.u))?;
266
267
+ let value = format!("{}", enabled);
268
builder.set(flag_name, value.as_str())?;
269
270
0 commit comments