8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "memory/allocation.inline.hpp"
26 #include "opto/addnode.hpp"
27 #include "opto/callnode.hpp"
28 #include "opto/loopnode.hpp"
29 #include "opto/movenode.hpp"
30 #include "opto/node.hpp"
31 #include "opto/opaquenode.hpp"
32 #include "opto/predicates.hpp"
33
34 //------------------------------split_thru_region------------------------------
35 // Split Node 'n' through merge point.
36 RegionNode* PhaseIdealLoop::split_thru_region(Node* n, RegionNode* region) {
37 assert(n->is_CFG(), "");
38 RegionNode* r = new RegionNode(region->req());
39 IdealLoopTree* loop = get_loop(n);
40 for (uint i = 1; i < region->req(); i++) {
41 Node* x = n->clone();
42 Node* in0 = n->in(0);
43 if (in0->in(0) == region) x->set_req(0, in0->in(i));
44 for (uint j = 1; j < n->req(); j++) {
45 Node* in = n->in(j);
46 if (get_ctrl(in) == region) {
47 x->set_req(j, in->in(i));
595 Node* n = region->out(i);
596 if( n == region ) continue;
597 // The IF to be split is OK.
598 if( n == iff ) continue;
599 if( !n->is_Phi() ) { // Found pinned memory op or such
600 if (split_up(n, region, iff)) {
601 i = region->refresh_out_pos(i);
602 progress = true;
603 }
604 continue;
605 }
606 assert( n->in(0) == region, "" );
607
608 // Recursively split up all users of a Phi
609 for (j = n->outs(); n->has_out(j); j++) {
610 Node* m = n->out(j);
611 // If m is dead, throw it away, and declare progress
612 if (_loop_or_ctrl[m->_idx] == nullptr) {
613 _igvn.remove_dead_node(m);
614 // fall through
615 }
616 else if (m != iff && split_up(m, region, iff)) {
617 // fall through
618 } else {
619 continue;
620 }
621 // Something unpredictable changed.
622 // Tell the iterators to refresh themselves, and rerun the loop.
623 i = region->refresh_out_pos(i);
624 j = region->refresh_out_pos(j);
625 progress = true;
626 }
627 }
628 }
629
630 // Now we have no instructions in the block containing the IF.
631 // Split the IF.
632 RegionNode *new_iff = split_thru_region(iff, region);
633
634 // Replace both uses of 'new_iff' with Regions merging True/False
635 // paths. This makes 'new_iff' go dead.
636 Node *old_false = nullptr, *old_true = nullptr;
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "memory/allocation.inline.hpp"
26 #include "opto/addnode.hpp"
27 #include "opto/callnode.hpp"
28 #include "opto/inlinetypenode.hpp"
29 #include "opto/loopnode.hpp"
30 #include "opto/movenode.hpp"
31 #include "opto/node.hpp"
32 #include "opto/opaquenode.hpp"
33 #include "opto/predicates.hpp"
34
35 //------------------------------split_thru_region------------------------------
36 // Split Node 'n' through merge point.
37 RegionNode* PhaseIdealLoop::split_thru_region(Node* n, RegionNode* region) {
38 assert(n->is_CFG(), "");
39 RegionNode* r = new RegionNode(region->req());
40 IdealLoopTree* loop = get_loop(n);
41 for (uint i = 1; i < region->req(); i++) {
42 Node* x = n->clone();
43 Node* in0 = n->in(0);
44 if (in0->in(0) == region) x->set_req(0, in0->in(i));
45 for (uint j = 1; j < n->req(); j++) {
46 Node* in = n->in(j);
47 if (get_ctrl(in) == region) {
48 x->set_req(j, in->in(i));
596 Node* n = region->out(i);
597 if( n == region ) continue;
598 // The IF to be split is OK.
599 if( n == iff ) continue;
600 if( !n->is_Phi() ) { // Found pinned memory op or such
601 if (split_up(n, region, iff)) {
602 i = region->refresh_out_pos(i);
603 progress = true;
604 }
605 continue;
606 }
607 assert( n->in(0) == region, "" );
608
609 // Recursively split up all users of a Phi
610 for (j = n->outs(); n->has_out(j); j++) {
611 Node* m = n->out(j);
612 // If m is dead, throw it away, and declare progress
613 if (_loop_or_ctrl[m->_idx] == nullptr) {
614 _igvn.remove_dead_node(m);
615 // fall through
616 } else if (m != iff && split_up(m, region, iff)) {
617 // fall through
618 } else {
619 continue;
620 }
621 // Something unpredictable changed.
622 // Tell the iterators to refresh themselves, and rerun the loop.
623 i = region->refresh_out_pos(i);
624 j = region->refresh_out_pos(j);
625 progress = true;
626 }
627 }
628 }
629
630 // Now we have no instructions in the block containing the IF.
631 // Split the IF.
632 RegionNode *new_iff = split_thru_region(iff, region);
633
634 // Replace both uses of 'new_iff' with Regions merging True/False
635 // paths. This makes 'new_iff' go dead.
636 Node *old_false = nullptr, *old_true = nullptr;
|