--- old/src/hotspot/share/opto/castnode.cpp 2018-03-07 15:00:26.168076010 +0100 +++ new/src/hotspot/share/opto/castnode.cpp 2018-03-07 15:00:25.984071765 +0100 @@ -462,6 +462,23 @@ uintptr_t bits = (uintptr_t) t->is_rawptr()->get_con(); return TypeX::make(bits); } + + PhaseIterGVN* igvn = phase->is_IterGVN(); + if (igvn != NULL && (t->is_zero_type() || !TypePtr::NULL_PTR->higher_equal(t))) { + for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) { + Node* u = fast_out(i); + if (u->Opcode() == Op_OrL) { + for (DUIterator_Fast jmax, j = u->fast_outs(jmax); j < jmax; j++) { + Node* cmp = u->fast_out(j); + if (cmp->Opcode() == Op_CmpL) { + // Give CmpL a chance to get optimized + igvn->_worklist.push(cmp); + } + } + } + } + } + return CastP2XNode::bottom_type(); }