From bc0b4ef15436f98b4e7fc87342320b5b4f10ef3c Mon Sep 17 00:00:00 2001
Date: Fri, 22 Jan 2021 14:30:40 +0800
Subject: Backport of JDK-8182036

summary: Load from initializing arraycopy uses wrong memory state
LLT:
Bug url: https://bugs.openjdk.java.net/browse/JDK-8182036
---
 hotspot/src/share/vm/opto/library_call.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
index cd1b1e5c0..89ebabe6f 100644
--- a/hotspot/src/share/vm/opto/library_call.cpp
+++ b/hotspot/src/share/vm/opto/library_call.cpp
@@ -5703,7 +5703,8 @@ LibraryCallKit::generate_block_arraycopy(const TypePtr* adr_type,
         ((src_off ^ dest_off) & (BytesPerLong-1)) == 0) {
       Node* sptr = basic_plus_adr(src,  src_off);
       Node* dptr = basic_plus_adr(dest, dest_off);
-      Node* sval = make_load(control(), sptr, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
+      const TypePtr* s_adr_type = _gvn.type(sptr)->is_ptr();
+      Node* sval = make_load(control(), sptr, TypeInt::INT, T_INT, s_adr_type, MemNode::unordered);
       store_to_memory(control(), dptr, sval, T_INT, adr_type, MemNode::unordered);
       src_off += BytesPerInt;
       dest_off += BytesPerInt;
-- 
2.19.0

