8194740: UseSubwordForMaxVector causes performance regression
authorvdeshpande
Mon, 09 Jul 2018 13:25:08 -0700
changeset 51017 dd7ce84016a5
parent 51016 a926b7737d3b
child 51018 591c34a66d41
8194740: UseSubwordForMaxVector causes performance regression Reviewed-by: kvn, thartmann
src/hotspot/share/opto/loopTransform.cpp
src/hotspot/share/opto/loopnode.hpp
src/hotspot/share/opto/superword.cpp
--- a/src/hotspot/share/opto/loopTransform.cpp	Mon Jul 09 11:15:55 2018 -0700
+++ b/src/hotspot/share/opto/loopTransform.cpp	Mon Jul 09 13:25:08 2018 -0700
@@ -861,7 +861,9 @@
 
   // Check for being too big
   if (body_size > (uint)_local_loop_unroll_limit) {
-    if ((UseSubwordForMaxVector || xors_in_loop >= 4) && body_size < (uint)LoopUnrollLimit * 4) return true;
+    if ((cl->is_subword_loop() || xors_in_loop >= 4) && body_size < (uint)LoopUnrollLimit * 4) {
+      return true;
+    }
     // Normal case: loop too big
     return false;
   }
--- a/src/hotspot/share/opto/loopnode.hpp	Mon Jul 09 11:15:55 2018 -0700
+++ b/src/hotspot/share/opto/loopnode.hpp	Mon Jul 09 13:25:08 2018 -0700
@@ -75,7 +75,8 @@
          HasRangeChecks=8192,
          IsMultiversioned=16384,
          StripMined=32768,
-         ProfileTripFailed=65536};
+         SubwordLoop=65536,
+         ProfileTripFailed=131072};
   char _unswitch_count;
   enum { _unswitch_max=3 };
   char _postloop_flags;
@@ -99,6 +100,7 @@
   bool partial_peel_has_failed() const { return _loop_flags & PartialPeelFailed; }
   bool is_strip_mined() const { return _loop_flags & StripMined; }
   bool is_profile_trip_failed() const { return _loop_flags & ProfileTripFailed; }
+  bool is_subword_loop() const { return _loop_flags & SubwordLoop; }
 
   void mark_partial_peel_failed() { _loop_flags |= PartialPeelFailed; }
   void mark_has_reductions() { _loop_flags |= HasReductions; }
@@ -112,6 +114,7 @@
   void mark_strip_mined() { _loop_flags |= StripMined; }
   void clear_strip_mined() { _loop_flags &= ~StripMined; }
   void mark_profile_trip_failed() { _loop_flags |= ProfileTripFailed; }
+  void mark_subword_loop() { _loop_flags |= SubwordLoop; }
 
   int unswitch_max() { return _unswitch_max; }
   int unswitch_count() { return _unswitch_count; }
--- a/src/hotspot/share/opto/superword.cpp	Mon Jul 09 11:15:55 2018 -0700
+++ b/src/hotspot/share/opto/superword.cpp	Mon Jul 09 13:25:08 2018 -0700
@@ -376,6 +376,7 @@
                 if (same_type) {
                   max_vector = cur_max_vector;
                   flag_small_bt = true;
+                  cl->mark_subword_loop();
                 }
               }
             }