1045 Node* st_adr = st->in(MemNode::Address); |
1045 Node* st_adr = st->in(MemNode::Address); |
1046 if (!phase->eqv(st_adr, ld_adr)) { |
1046 if (!phase->eqv(st_adr, ld_adr)) { |
1047 // Try harder before giving up. Unify base pointers with casts (e.g., raw/non-raw pointers). |
1047 // Try harder before giving up. Unify base pointers with casts (e.g., raw/non-raw pointers). |
1048 intptr_t st_off = 0; |
1048 intptr_t st_off = 0; |
1049 Node* st_base = AddPNode::Ideal_base_and_offset(st_adr, phase, st_off); |
1049 Node* st_base = AddPNode::Ideal_base_and_offset(st_adr, phase, st_off); |
1050 if (ld_base == NULL) return NULL; |
1050 if (ld_base == NULL) return NULL; |
1051 if (st_base == NULL) return NULL; |
1051 if (st_base == NULL) return NULL; |
1052 if (ld_base->uncast() != st_base->uncast()) return NULL; |
1052 if (!ld_base->eqv_uncast(st_base, /*keep_deps=*/true)) return NULL; |
1053 if (ld_off != st_off) return NULL; |
1053 if (ld_off != st_off) return NULL; |
1054 if (ld_off == Type::OffsetBot) return NULL; |
1054 if (ld_off == Type::OffsetBot) return NULL; |
1055 // Same base, same offset. |
1055 // Same base, same offset. |
1056 // Possible improvement for arrays: check index value instead of absolute offset. |
1056 // Possible improvement for arrays: check index value instead of absolute offset. |
1057 |
1057 |
1058 // At this point we have proven something like this setup: |
1058 // At this point we have proven something like this setup: |
1059 // B = << base >> |
1059 // B = << base >> |
1060 // L = LoadQ(AddP(Check/CastPP(B), #Off)) |
1060 // L = LoadQ(AddP(Check/CastPP(B), #Off)) |
1061 // S = StoreQ(AddP( B , #Off), V) |
1061 // S = StoreQ(AddP( B , #Off), V) |
1062 // (Actually, we haven't yet proven the Q's are the same.) |
1062 // (Actually, we haven't yet proven the Q's are the same.) |
1063 // In other words, we are loading from a casted version of |
1063 // In other words, we are loading from a casted version of |
1064 // the same pointer-and-offset that we stored to. |
1064 // the same pointer-and-offset that we stored to. |
|
1065 // Casted version may carry a dependency and it is respected. |
1065 // Thus, we are able to replace L by V. |
1066 // Thus, we are able to replace L by V. |
1066 } |
1067 } |
1067 // Now prove that we have a LoadQ matched to a StoreQ, for some Q. |
1068 // Now prove that we have a LoadQ matched to a StoreQ, for some Q. |
1068 if (store_Opcode() != st->Opcode()) |
1069 if (store_Opcode() != st->Opcode()) |
1069 return NULL; |
1070 return NULL; |