Fuzzbug fix

This commit is contained in:
Chris Fallin
2021-06-01 18:57:07 -07:00
parent 2614eac21e
commit a2a770ec50

View File

@@ -3121,15 +3121,17 @@ impl<'a, F: Function> Env<'a, F> {
|| lowest_cost_evict_conflict_cost.is_some() || lowest_cost_evict_conflict_cost.is_some()
); );
// Check that we haven't attempted more than once with a let our_spill_weight = self.bundle_spill_weight(bundle);
// minimal bundle -- this would indicate a bug. We detect
// the "too-many-live-registers" case here and return an // We detect the "too-many-live-registers" case here and
// error cleanly, rather than panicking, because the // return an error cleanly, rather than panicking, because
// regalloc.rs fuzzer depends on the register allocator to // the regalloc.rs fuzzer depends on the register
// correctly reject impossible-to-allocate programs in // allocator to correctly reject impossible-to-allocate
// order to discard invalid test cases. // programs in order to discard invalid test cases.
if self.minimal_bundle(bundle) if self.minimal_bundle(bundle)
&& (attempts >= 2 || lowest_cost_evict_conflict_cost.is_none()) && (attempts >= 2
|| lowest_cost_evict_conflict_cost.is_none()
|| lowest_cost_evict_conflict_cost.unwrap() >= our_spill_weight)
{ {
if let Requirement::Register(class) = req { if let Requirement::Register(class) = req {
// Check if this is a too-many-live-registers situation. // Check if this is a too-many-live-registers situation.
@@ -3180,7 +3182,7 @@ impl<'a, F: Function> Env<'a, F> {
if !self.minimal_bundle(bundle) if !self.minimal_bundle(bundle)
&& (attempts >= 2 && (attempts >= 2
|| lowest_cost_evict_conflict_cost.is_none() || lowest_cost_evict_conflict_cost.is_none()
|| self.bundle_spill_weight(bundle) <= lowest_cost_evict_conflict_cost.unwrap()) || our_spill_weight <= lowest_cost_evict_conflict_cost.unwrap())
{ {
log::debug!( log::debug!(
" -> deciding to split: our spill weight is {}", " -> deciding to split: our spill weight is {}",