changeset 23013:a1b5fe34c604

8076523: assert(((ABS(iv_adjustment_in_bytes) % elt_size) == 0)) fails in superword.cpp Summary: check that offset % mem_oper_size == 0 when alignment is verified during vectorization. Reviewed-by: iveresov
author kvn
date Thu, 02 Apr 2015 17:16:39 -0700
parents 5f8824f56f39
children 84d55f179e24
files src/share/vm/opto/superword.cpp
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/superword.cpp	Fri Apr 17 17:39:19 2015 -0700
+++ b/src/share/vm/opto/superword.cpp	Thu Apr 02 17:16:39 2015 -0700
@@ -445,11 +445,13 @@
   int preloop_stride = pre_end->stride_con();
 
   int span = preloop_stride * p.scale_in_bytes();
-
-  // Stride one accesses are alignable.
-  if (ABS(span) == p.memory_size())
+  int mem_size = p.memory_size();
+  int offset   = p.offset_in_bytes();
+  // Stride one accesses are alignable if offset is aligned to memory operation size.
+  // Offset can be unaligned when UseUnalignedAccesses is used.
+  if (ABS(span) == mem_size && (ABS(offset) % mem_size) == 0) {
     return true;
-
+  }
   // If initial offset from start of object is computable,
   // compute alignment within the vector.
   int vw = vector_width_in_bytes(p.mem());
@@ -459,7 +461,7 @@
     if (init_nd->is_Con() && p.invar() == NULL) {
       int init = init_nd->bottom_type()->is_int()->get_con();
 
-      int init_offset = init * p.scale_in_bytes() + p.offset_in_bytes();
+      int init_offset = init * p.scale_in_bytes() + offset;
       assert(init_offset >= 0, "positive offset from object start");
 
       if (span > 0) {