Use PackedOption<Inst> in the dominator tree.
Also rework the algorithm to be more robust against unreachable blocks. - Add an is_reachable(ebb) method. - Change idom(ebb) to just return an instruction. - Make idom() return None for the entry block as well as unreachable blocks.
This commit is contained in:
@@ -48,6 +48,11 @@ impl<T: ReservedValue> PackedOption<T> {
|
||||
self.expand().unwrap()
|
||||
}
|
||||
|
||||
/// Unwrap a packed `Some` value or panic.
|
||||
pub fn expect(self, msg: &str) -> T {
|
||||
self.expand().expect(msg)
|
||||
}
|
||||
|
||||
/// Takes the value out of the packed option, leaving a `None` in its place.
|
||||
pub fn take(&mut self) -> Option<T> {
|
||||
mem::replace(self, None.into()).expand()
|
||||
|
||||
Reference in New Issue
Block a user