< prev index next >

src/hotspot/share/opto/loopopts.cpp

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -519,12 +519,12 @@
        n->swap_edges(1, 2);
      }
    }
  
    // Replace ((I1 +p V) +p I2) with ((I1 +p I2) +p V),
-   // but not if I2 is a constant.
-   if (n_op == Op_AddP) {
+   // but not if I2 is a constant. Skip for irreducible loops.
+   if (n_op == Op_AddP && n_loop->_head->is_Loop()) {
      if (n2_loop == n_loop && n3_loop != n_loop) {
        if (n->in(2)->Opcode() == Op_AddP && !n->in(3)->is_Con()) {
          Node* n22_ctrl = get_ctrl(n->in(2)->in(2));
          Node* n23_ctrl = get_ctrl(n->in(2)->in(3));
          IdealLoopTree* n22loop = get_loop(n22_ctrl);
< prev index next >