@@ -1172,7 +1172,7 @@ impl Insn {
11721172 Insn :: LoadSelf { .. } => Effect :: read_write ( abstract_heaps:: Frame , abstract_heaps:: Empty ) ,
11731173 Insn :: LoadField { .. } => Effect :: read_write ( abstract_heaps:: Memory , abstract_heaps:: Empty ) ,
11741174 Insn :: StoreField { .. } => effects:: Any ,
1175- Insn :: WriteBarrier { .. } => effects:: Any ,
1175+ Insn :: WriteBarrier { .. } => effects:: Allocator ,
11761176 Insn :: GetLocal { .. } => Effect :: read_write ( abstract_heaps:: Locals , abstract_heaps:: Empty ) ,
11771177 Insn :: SetLocal { .. } => effects:: Any ,
11781178 Insn :: GetSpecialSymbol { .. } => effects:: Any ,
@@ -1262,6 +1262,9 @@ impl Insn {
12621262 /// Note: These are restrictions on the `write` `EffectSet` only. Even instructions with
12631263 /// `read: effects::Any` could potentially be omitted.
12641264 fn is_elidable ( & self ) -> bool {
1265+ if let Insn :: WriteBarrier { .. } = self {
1266+ return false
1267+ }
12651268 abstract_heaps:: Allocator . includes ( self . effects_of ( ) . write_bits ( ) )
12661269 }
12671270}
@@ -4486,41 +4489,35 @@ impl Function {
44864489 // The key for the hashmap should be type and offset, with a value of value
44874490 // This lets us to index in with both load and store fields since insn_ids are probably always going to be different and we can't easily match on that
44884491 // So... how do we match against and store the enum label without all the data?? not sure yet :/
4489- eprintln ! ( "{}" , FunctionPrinter :: with_snapshot( self ) ) ;
44904492 let mut compile_time_heap: HashMap < ( InsnId , i32 ) , InsnId > = HashMap :: new ( ) ;
44914493 for block in self . rpo ( ) {
44924494 let old_insns = std:: mem:: take ( & mut self . blocks [ block. 0 ] . insns ) ;
44934495 let mut new_insns = vec ! [ ] ;
44944496 for insn_id in old_insns {
44954497 let replacement_insn: InsnId = match self . find ( insn_id) {
44964498 Insn :: StoreField { recv, offset, val, .. } => {
4497- let key = ( recv, offset) ;
4498- eprintln ! ( "hi jane" ) ;
4499+ let key = ( self . chase_insn ( recv) , offset) ;
44994500 let heap_entry = compile_time_heap. get ( & key) . copied ( ) ;
4500- eprintln ! ( "{heap_entry:?}" ) ;
45014501 // TODO(Jacob): Switch from actual to partial equality
45024502 if Some ( val) == heap_entry {
4503- eprintln ! ( "Matched value {val}, {heap_entry:?}" ) ;
45044503 // TODO(Jacob): Add TBAA to avoid removing so many entries
4505- eprintln ! ( "Erasing aliasing offsets {offset}" ) ;
45064504 compile_time_heap. retain ( |( _, off) , _| * off != offset) ;
45074505 // If the value is already stored, short circuit and don't add an instruction to the block
45084506 continue
45094507 }
45104508 // TODO(Jacob): Add TBAA to avoid removing so many entries
4511- eprintln ! ( "Erasing aliasing offsets {offset}" ) ;
45124509 compile_time_heap. retain ( |( _, off) , _| * off != offset) ;
45134510 compile_time_heap. insert ( key, val) ;
4514- eprintln ! ( "Inserted into heap {key:?}, {val}" ) ;
45154511 insn_id
45164512 } ,
45174513 Insn :: LoadField { recv, offset, .. } => {
4518- let key = ( recv, offset) ;
4514+ let key = ( self . chase_insn ( recv) , offset) ;
45194515 match compile_time_heap. entry ( key) {
45204516 std:: collections:: hash_map:: Entry :: Occupied ( entry) => {
45214517 // If the value is already saved, we can't short circuit like we can with a store.
45224518 // However, we can avoid the load with a reference to the representative to the union from SSA.
45234519 self . make_equal_to ( insn_id, * entry. get ( ) ) ;
4520+ continue
45244521 }
45254522 std:: collections:: hash_map:: Entry :: Vacant ( _) => {
45264523 // TODO(Jacob): Make sure this is correct, could be wrong?
@@ -4532,7 +4529,6 @@ impl Function {
45324529 insn => {
45334530 // If an instruction affects memory and we haven't modeled it, the compile_time_heap is invalidated
45344531 if insn. effects_of ( ) . includes ( Effect :: write ( abstract_heaps:: Memory ) ) {
4535- eprintln ! ( "Clearing... {insn:?}" ) ;
45364532 compile_time_heap. clear ( ) ;
45374533 }
45384534 insn_id
0 commit comments