Fix the moves fuzz target. (#97)

* Fix iteration bug in move fuzz-target driver.

* Remove panic no longer needed: stack-to-stack moves are now properly handled.
This commit is contained in:
Chris Fallin
2022-10-21 09:08:27 -07:00
committed by GitHub
parent d6b15095c5
commit b4eedf3f32

View File

@@ -62,7 +62,7 @@ impl Arbitrary<'_> for TestCase {
// We might have some unallocated registers free for scratch // We might have some unallocated registers free for scratch
// space... // space...
for i in u.int_in_range(0..=2) { for i in 0..u.int_in_range(0..=2)? {
let reg = PReg::new(30 + i, RegClass::Int); let reg = PReg::new(30 + i, RegClass::Int);
ret.available_pregs.push(Allocation::reg(reg)); ret.available_pregs.push(Allocation::reg(reg));
} }
@@ -107,10 +107,6 @@ fuzz_target!(|testcase: TestCase| {
// Simulate the sequence of moves. // Simulate the sequence of moves.
let mut locations: HashMap<Allocation, Allocation> = HashMap::new(); let mut locations: HashMap<Allocation, Allocation> = HashMap::new();
for (src, dst, _) in moves { for (src, dst, _) in moves {
if is_stack_alloc(src) && is_stack_alloc(dst) {
panic!("Stack-to-stack move!");
}
let data = locations.get(&src).cloned().unwrap_or(src); let data = locations.get(&src).cloned().unwrap_or(src);
locations.insert(dst, data); locations.insert(dst, data);
} }