1 /*
2 * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
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 */
173 _phase->has_range_checks(lpt_next);
174 if (cl_next->is_post_loop() && !cl_next->range_checks_present()) {
175 if (!cl_next->is_vectorized_loop()) {
176 int slp_max_unroll_factor = cl->slp_max_unroll();
177 cl_next->set_slp_max_unroll(slp_max_unroll_factor);
178 }
179 }
180 }
181 }
182 }
183 }
184
185 //------------------------------early unrolling analysis------------------------------
186 void SuperWord::unrolling_analysis(int &local_loop_unroll_factor) {
187 bool is_slp = true;
188 ResourceMark rm;
189 size_t ignored_size = lpt()->_body.size();
190 int *ignored_loop_nodes = NEW_RESOURCE_ARRAY(int, ignored_size);
191 Node_Stack nstack((int)ignored_size);
192 CountedLoopNode *cl = lpt()->_head->as_CountedLoop();
193 Node *cl_exit = cl->loopexit();
194 int rpo_idx = _post_block.length();
195
196 assert(rpo_idx == 0, "post loop block is empty");
197
198 // First clear the entries
199 for (uint i = 0; i < lpt()->_body.size(); i++) {
200 ignored_loop_nodes[i] = -1;
201 }
202
203 int max_vector = Matcher::max_vector_size(T_BYTE);
204 bool post_loop_allowed = (PostLoopMultiversioning && Matcher::has_predicated_vectors() && cl->is_post_loop());
205
206 // Process the loop, some/all of the stack entries will not be in order, ergo
207 // need to preprocess the ignored initial state before we process the loop
208 for (uint i = 0; i < lpt()->_body.size(); i++) {
209 Node* n = lpt()->_body.at(i);
210 if (n == cl->incr() ||
211 n->is_reduction() ||
212 n->is_AddP() ||
213 n->is_Cmp() ||
|
1 /*
2 * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
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 */
173 _phase->has_range_checks(lpt_next);
174 if (cl_next->is_post_loop() && !cl_next->range_checks_present()) {
175 if (!cl_next->is_vectorized_loop()) {
176 int slp_max_unroll_factor = cl->slp_max_unroll();
177 cl_next->set_slp_max_unroll(slp_max_unroll_factor);
178 }
179 }
180 }
181 }
182 }
183 }
184
185 //------------------------------early unrolling analysis------------------------------
186 void SuperWord::unrolling_analysis(int &local_loop_unroll_factor) {
187 bool is_slp = true;
188 ResourceMark rm;
189 size_t ignored_size = lpt()->_body.size();
190 int *ignored_loop_nodes = NEW_RESOURCE_ARRAY(int, ignored_size);
191 Node_Stack nstack((int)ignored_size);
192 CountedLoopNode *cl = lpt()->_head->as_CountedLoop();
193 Node *cl_exit = cl->loopexit_or_null();
194 int rpo_idx = _post_block.length();
195
196 assert(rpo_idx == 0, "post loop block is empty");
197
198 // First clear the entries
199 for (uint i = 0; i < lpt()->_body.size(); i++) {
200 ignored_loop_nodes[i] = -1;
201 }
202
203 int max_vector = Matcher::max_vector_size(T_BYTE);
204 bool post_loop_allowed = (PostLoopMultiversioning && Matcher::has_predicated_vectors() && cl->is_post_loop());
205
206 // Process the loop, some/all of the stack entries will not be in order, ergo
207 // need to preprocess the ignored initial state before we process the loop
208 for (uint i = 0; i < lpt()->_body.size(); i++) {
209 Node* n = lpt()->_body.at(i);
210 if (n == cl->incr() ||
211 n->is_reduction() ||
212 n->is_AddP() ||
213 n->is_Cmp() ||
|