cranelift: Fuzz cold blocks (#4654)

This commit is contained in:
Afonso Bordado
2022-08-09 20:43:08 +01:00
committed by GitHub
parent a4aa7258de
commit d5de91b953

View File

@@ -639,11 +639,19 @@ where
let blocks = (0..block_count)
.map(|i| {
let is_entry = i == 0;
let block = builder.create_block();
// Optionally mark blocks that are not the entry block as cold
if !is_entry {
if bool::arbitrary(self.u)? {
builder.set_cold_block(block);
}
}
// The first block has to have the function signature, but for the rest of them we generate
// a random signature;
if i == 0 {
if is_entry {
builder.append_block_params_for_function_params(block);
Ok((block, sig.params.iter().map(|a| a.value_type).collect()))
} else {