< prev index next >

src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp

Print this page
rev 53156 : Use BarrierSetC2::ideal_node() API for CmpPNode::Ideal()
rev 53157 : [mq]: remove-leftovers.patch

@@ -845,11 +845,11 @@
 
 Node* ShenandoahBarrierSetC2::array_copy_load_store_barrier(PhaseGVN *phase, bool can_reshape, Node* v, MergeMemNode* mem, Node*& ctl) const {
   if (ShenandoahStoreValReadBarrier) {
     RegionNode* region = new RegionNode(3);
     const Type* v_t = phase->type(v);
-    Node* phi = new PhiNode(region, v_t->isa_oopptr() ? v_t->is_oopptr()->cast_to_nonconst() : v_t);
+    Node* phi = new PhiNode(region, v_t);
     Node* cmp = phase->transform(new CmpPNode(v, phase->zerocon(T_OBJECT)));
     Node* bol = phase->transform(new BoolNode(cmp, BoolTest::ne));
     IfNode* iff = new IfNode(ctl, bol, PROB_LIKELY_MAG(3), COUNT_UNKNOWN);
 
     phase->transform(iff);

@@ -1007,10 +1007,39 @@
         }
         return n;
       }
     }
   }
+  if (n->Opcode() == Op_CmpP) {
+    Node* in1 = n->in(1);
+    Node* in2 = n->in(2);
+    if (in1->bottom_type() == TypePtr::NULL_PTR) {
+      in2 = step_over_gc_barrier(in2);
+    }
+    if (in2->bottom_type() == TypePtr::NULL_PTR) {
+      in1 = step_over_gc_barrier(in1);
+    }
+    PhaseIterGVN* igvn = phase->is_IterGVN();
+    if (in1 != n->in(1)) {
+      if (igvn != NULL) {
+        n->set_req_X(1, in1, igvn);
+      } else {
+        n->set_req(1, in1);
+      }
+      assert(in2 == n->in(2), "only one change");
+      return n;
+    }
+    if (in2 != n->in(2)) {
+      if (igvn != NULL) {
+        n->set_req_X(2, in2, igvn);
+      } else {
+        n->set_req(2, in2);
+      }
+      return n;
+    }
+  }
+
   return NULL;
 }
 
 bool ShenandoahBarrierSetC2::has_only_shenandoah_wb_pre_uses(Node* n) {
   for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
< prev index next >