2199 |
2199 |
2200 // Back-to-back stores to same address? Fold em up. Generally |
2200 // Back-to-back stores to same address? Fold em up. Generally |
2201 // unsafe if I have intervening uses... Also disallowed for StoreCM |
2201 // unsafe if I have intervening uses... Also disallowed for StoreCM |
2202 // since they must follow each StoreP operation. Redundant StoreCMs |
2202 // since they must follow each StoreP operation. Redundant StoreCMs |
2203 // are eliminated just before matching in final_graph_reshape. |
2203 // are eliminated just before matching in final_graph_reshape. |
2204 if (mem->is_Store() && phase->eqv_uncast(mem->in(MemNode::Address), address) && |
2204 if (mem->is_Store() && mem->in(MemNode::Address)->eqv_uncast(address) && |
2205 mem->Opcode() != Op_StoreCM) { |
2205 mem->Opcode() != Op_StoreCM) { |
2206 // Looking at a dead closed cycle of memory? |
2206 // Looking at a dead closed cycle of memory? |
2207 assert(mem != mem->in(MemNode::Memory), "dead loop in StoreNode::Ideal"); |
2207 assert(mem != mem->in(MemNode::Memory), "dead loop in StoreNode::Ideal"); |
2208 |
2208 |
2209 assert(Opcode() == mem->Opcode() || |
2209 assert(Opcode() == mem->Opcode() || |
2272 Node* adr = in(MemNode::Address); |
2272 Node* adr = in(MemNode::Address); |
2273 Node* val = in(MemNode::ValueIn); |
2273 Node* val = in(MemNode::ValueIn); |
2274 |
2274 |
2275 // Load then Store? Then the Store is useless |
2275 // Load then Store? Then the Store is useless |
2276 if (val->is_Load() && |
2276 if (val->is_Load() && |
2277 phase->eqv_uncast( val->in(MemNode::Address), adr ) && |
2277 val->in(MemNode::Address)->eqv_uncast(adr) && |
2278 phase->eqv_uncast( val->in(MemNode::Memory ), mem ) && |
2278 val->in(MemNode::Memory )->eqv_uncast(mem) && |
2279 val->as_Load()->store_Opcode() == Opcode()) { |
2279 val->as_Load()->store_Opcode() == Opcode()) { |
2280 return mem; |
2280 return mem; |
2281 } |
2281 } |
2282 |
2282 |
2283 // Two stores in a row of the same value? |
2283 // Two stores in a row of the same value? |
2284 if (mem->is_Store() && |
2284 if (mem->is_Store() && |
2285 phase->eqv_uncast( mem->in(MemNode::Address), adr ) && |
2285 mem->in(MemNode::Address)->eqv_uncast(adr) && |
2286 phase->eqv_uncast( mem->in(MemNode::ValueIn), val ) && |
2286 mem->in(MemNode::ValueIn)->eqv_uncast(val) && |
2287 mem->Opcode() == Opcode()) { |
2287 mem->Opcode() == Opcode()) { |
2288 return mem; |
2288 return mem; |
2289 } |
2289 } |
2290 |
2290 |
2291 // Store of zero anywhere into a freshly-allocated object? |
2291 // Store of zero anywhere into a freshly-allocated object? |