Check that the old target is different from the new collapsed one,
before concluding that anything changed.
Terminator { kind: TerminatorKind::Goto { ref mut target }, .. } => target,
_ => unreachable!(),
};
+ *changed |= *target != last;
*target = last;
debug!("collapsing goto chain from {:?} to {:?}", current, target);
self.pred_count[*target] += 1;
self.pred_count[current] -= 1;
}
- *changed = true;
self.basic_blocks[current].terminator = Some(terminator);
}
}
--- /dev/null
+// Caused an infinite loop during SimlifyCfg MIR transform previously.
+//
+// build-pass
+
+fn main() {
+ loop { continue; }
+}