Revert "simple_gvn: recognize commutative operators (#6135)" (#6142)

This reverts commit c85bf27ff8.
This commit is contained in:
Jamey Sharp
2023-04-04 13:22:44 -07:00
committed by GitHub
parent 57e42d0c46
commit 81545c3a86
12 changed files with 33 additions and 153 deletions

View File

@@ -35,14 +35,6 @@ struct HashKey<'a, 'f: 'a> {
ty: Type,
pos: &'a RefCell<FuncCursor<'f>>,
}
impl<'a, 'f: 'a> HashKey<'a, 'f> {
fn new(mut inst: InstructionData, ty: Type, pos: &'a RefCell<FuncCursor<'f>>) -> Self {
inst.normalize_in_place();
Self { inst, ty, pos }
}
}
impl<'a, 'f: 'a> Hash for HashKey<'a, 'f> {
fn hash<H: Hasher>(&self, state: &mut H) {
let pool = &self.pos.borrow().func.dfg.value_lists;
@@ -121,7 +113,11 @@ pub fn do_simple_gvn(func: &mut Function, domtree: &mut DominatorTree) {
}
let ctrl_typevar = func.dfg.ctrl_typevar(inst);
let key = HashKey::new(func.dfg.insts[inst], ctrl_typevar, &pos);
let key = HashKey {
inst: func.dfg.insts[inst],
ty: ctrl_typevar,
pos: &pos,
};
use crate::scoped_hash_map::Entry::*;
match visible_values.entry(key) {
Occupied(entry) => {