8255534: Shenandoah: Fix CmpP optimization wrt native-LRB

Reviewed-by: shade
This commit is contained in:
Roman Kennke 2020-10-29 12:55:54 +00:00
parent 579e50bb40
commit faf23de54d

View File

@ -1059,14 +1059,19 @@ Node* ShenandoahBarrierSetC2::ideal_node(PhaseGVN* phase, Node* n, bool can_resh
if (n->Opcode() == Op_CmpP) { if (n->Opcode() == Op_CmpP) {
Node* in1 = n->in(1); Node* in1 = n->in(1);
Node* in2 = n->in(2); Node* in2 = n->in(2);
// If one input is NULL, then step over the barriers (except LRB native) on the other input
if (in1->bottom_type() == TypePtr::NULL_PTR && if (in1->bottom_type() == TypePtr::NULL_PTR &&
(in1->Opcode() != Op_ShenandoahLoadReferenceBarrier || !((ShenandoahLoadReferenceBarrierNode*)in1)->is_native())) { !((in2->Opcode() == Op_ShenandoahLoadReferenceBarrier) &&
((ShenandoahLoadReferenceBarrierNode*)in2)->is_native())) {
in2 = step_over_gc_barrier(in2); in2 = step_over_gc_barrier(in2);
} }
if (in2->bottom_type() == TypePtr::NULL_PTR && if (in2->bottom_type() == TypePtr::NULL_PTR &&
(in2->Opcode() != Op_ShenandoahLoadReferenceBarrier || !((ShenandoahLoadReferenceBarrierNode*)in2)->is_native())) { !((in1->Opcode() == Op_ShenandoahLoadReferenceBarrier) &&
((ShenandoahLoadReferenceBarrierNode*)in1)->is_native())) {
in1 = step_over_gc_barrier(in1); in1 = step_over_gc_barrier(in1);
} }
PhaseIterGVN* igvn = phase->is_IterGVN(); PhaseIterGVN* igvn = phase->is_IterGVN();
if (in1 != n->in(1)) { if (in1 != n->in(1)) {
if (igvn != NULL) { if (igvn != NULL) {