< prev index next >

src/hotspot/share/opto/superword.cpp

Print this page

        

@@ -3478,10 +3478,34 @@
   if (base->is_top() && !Matcher::misaligned_vectors_ok()) {
     assert(!valid(), "unsafe access");
     return;
   }
 
+  // Detect a Shenandoah write barrier between the pre and main loop
+  // (which could break loop alignment code)
+  if (UseShenandoahGC) {
+    CountedLoopNode *main_head = slp->lp()->as_CountedLoop();
+    if (main_head->is_main_loop()) {
+      Node* c = main_head->skip_predicates()->in(0)->in(0)->in(0);
+      if (!c->is_CountedLoopEnd()) {
+        // in case of a reserve copy
+        c = main_head->skip_strip_mined()->in(LoopNode::EntryControl)->in(0)->in(0);
+        c = CountedLoopNode::skip_predicates_from_entry(c);
+        c = c->in(0)->in(0)->in(0);
+        assert(c->is_CountedLoopEnd(), "where's the pre loop?");
+      }
+      CountedLoopEndNode* pre_end = c->as_CountedLoopEnd();
+      CountedLoopNode* pre_loop = pre_end->loopnode();
+      assert(pre_loop->is_pre_loop(), "where's the pre loop?");
+
+      Node* base_c = phase()->get_ctrl(base);
+      if (!phase()->is_dominator(base_c, pre_loop)) {
+        return;
+      }
+    }
+  }
+
   NOT_PRODUCT(if(_slp->is_trace_alignment()) _tracer.store_depth();)
   NOT_PRODUCT(_tracer.ctor_2(adr);)
 
   int i;
   for (i = 0; i < 3; i++) {
< prev index next >