Skip to content

Commit a2f99fd

Browse files
committed
8354383: C2: enable sinking of Type nodes out of loop
Reviewed-by: chagedorn, thartmann
1 parent 0582bd2 commit a2f99fd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/hotspot/share/opto/loopopts.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,6 +1676,10 @@ bool PhaseIdealLoop::safe_for_if_replacement(const Node* dom) const {
16761676
// like various versions of induction variable+offset. Clone the
16771677
// computation per usage to allow it to sink out of the loop.
16781678
void PhaseIdealLoop::try_sink_out_of_loop(Node* n) {
1679+
bool is_raw_to_oop_cast = n->is_ConstraintCast() &&
1680+
n->in(1)->bottom_type()->isa_rawptr() &&
1681+
!n->bottom_type()->isa_rawptr();
1682+
16791683
if (has_ctrl(n) &&
16801684
!n->is_Phi() &&
16811685
!n->is_Bool() &&
@@ -1685,7 +1689,9 @@ void PhaseIdealLoop::try_sink_out_of_loop(Node* n) {
16851689
!n->is_OpaqueNotNull() &&
16861690
!n->is_OpaqueInitializedAssertionPredicate() &&
16871691
!n->is_OpaqueTemplateAssertionPredicate() &&
1688-
!n->is_Type()) {
1692+
!is_raw_to_oop_cast && // don't extend live ranges of raw oops
1693+
(KillPathsReachableByDeadTypeNode || !n->is_Type())
1694+
) {
16891695
Node *n_ctrl = get_ctrl(n);
16901696
IdealLoopTree *n_loop = get_loop(n_ctrl);
16911697

0 commit comments

Comments
 (0)