Fix more GVN issues (#83)

* Fix GVN skipping the instruction after a deleted instruction.

* Teach GVN to resolve aliases as it proceeds.

* Clean up an obsolete reference to extended_values.
This commit is contained in:
Dan Gohman
2017-05-25 16:37:31 -07:00
committed by GitHub
parent c826aefa0a
commit 0e023e97ea
4 changed files with 59 additions and 14 deletions

View File

@@ -923,6 +923,18 @@ impl<'f> Cursor<'f> {
inst
}
/// Remove the instruction under the cursor.
///
/// The cursor is left pointing at the position preceding the current instruction.
///
/// Return the instruction that was removed.
pub fn remove_inst_and_step_back(&mut self) -> Inst {
let inst = self.current_inst().expect("No instruction to remove");
self.prev_inst();
self.layout.remove_inst(inst);
inst
}
/// Insert an EBB at the current position and switch to it.
///
/// As far as possible, this method behaves as if the EBB header were an instruction inserted