cranelift: Fuzz cold blocks (#4654)
This commit is contained in:
@@ -639,11 +639,19 @@ where
|
|||||||
|
|
||||||
let blocks = (0..block_count)
|
let blocks = (0..block_count)
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
|
let is_entry = i == 0;
|
||||||
let block = builder.create_block();
|
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
|
// The first block has to have the function signature, but for the rest of them we generate
|
||||||
// a random signature;
|
// a random signature;
|
||||||
if i == 0 {
|
if is_entry {
|
||||||
builder.append_block_params_for_function_params(block);
|
builder.append_block_params_for_function_params(block);
|
||||||
Ok((block, sig.params.iter().map(|a| a.value_type).collect()))
|
Ok((block, sig.params.iter().map(|a| a.value_type).collect()))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user