(&mut self, func: &Function, inst: Inst)
| 88 | |
| 89 | impl LastStores { |
| 90 | fn update(&mut self, func: &Function, inst: Inst) { |
| 91 | let opcode = func.dfg.insts[inst].opcode(); |
| 92 | if has_memory_fence_semantics(opcode) { |
| 93 | self.regions.clear(); |
| 94 | self.last_fence = inst.into(); |
| 95 | self.other = inst.into(); |
| 96 | } else if opcode.can_store() { |
| 97 | if let Some(memflags) = func.dfg.insts[inst].memflags() { |
| 98 | match func.dfg.mem_flags[memflags].alias_region() { |
| 99 | Some(region) => self.regions[region] = inst.into(), |
| 100 | None => { |
| 101 | // A store with no alias region may alias any region, so |
| 102 | // treat it like a fence: clear all regions and update |
| 103 | // `last_fence` so that subsequent region-tagged loads don't |
| 104 | // forward stale values past this store. |
| 105 | self.regions.clear(); |
| 106 | self.last_fence = inst.into(); |
| 107 | self.other = inst.into(); |
| 108 | } |
| 109 | } |
| 110 | } else { |
| 111 | // Store with no memflags: must clobber everything. |
| 112 | self.regions.clear(); |
| 113 | self.last_fence = inst.into(); |
| 114 | self.other = inst.into(); |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | fn get_last_store(&self, func: &Function, inst: Inst) -> PackedOption<Inst> { |
| 120 | if let Some(memflags) = func.dfg.insts[inst].memflags() { |
no test coverage detected