Make a copy of strip mined loops with small number of iterations from profiling
Roland Westrelin
rwestrel at redhat.com
Fri Mar 3 15:54:43 UTC 2017
> Okay. Introduce the const variable (right at the method) for this, please? Some
> wording about how it is chosen would be nice, even if it says "this is a blind
> guess":
> LoopStripMiningIter / 10
What about this (yes that magic constant was already used elsewhere)?
Roland.
diff --git a/src/share/vm/opto/c2_globals.hpp b/src/share/vm/opto/c2_globals.hpp
--- a/src/share/vm/opto/c2_globals.hpp
+++ b/src/share/vm/opto/c2_globals.hpp
@@ -741,6 +741,10 @@
"Number of iterations in strip mined loop") \
range(0, max_juint) \
\
+ product(intx, LoopStripMiningIterShortLoop, 0, \
+ "Loop with fewer iterations are not strip mined") \
+ range(0, max_juint) \
+ \
product(bool, LoopStripMiningCopyShort, true, \
"Make a copy of loop with no strip mining when profiling shows " \
"they execute few iterations") \
diff --git a/src/share/vm/opto/loopTransform.cpp b/src/share/vm/opto/loopTransform.cpp
--- a/src/share/vm/opto/loopTransform.cpp
+++ b/src/share/vm/opto/loopTransform.cpp
@@ -2792,7 +2792,7 @@
cl->is_strip_mined() &&
!cl->is_strip_mined_short_cloned() &&
!cl->has_exact_trip_count() &&
- cl->profile_trip_cnt() < LoopStripMiningIter / 10) {
+ cl->profile_trip_cnt() < LoopStripMiningIterShortLoop) {
int nodes_left = phase->C->max_node_limit() - phase->C->live_nodes();
if ((int)(2 * _body.size()) <= nodes_left) {
int stride = cl->stride_con();
diff --git a/src/share/vm/opto/opaquenode.cpp b/src/share/vm/opto/opaquenode.cpp
--- a/src/share/vm/opto/opaquenode.cpp
+++ b/src/share/vm/opto/opaquenode.cpp
@@ -97,10 +97,11 @@
int stride = inner_cl->stride_con();
jlong scaled_iters_long = ((jlong)LoopStripMiningIter) * ABS(stride);
int scaled_iters = (int)scaled_iters_long;
+ int short_scaled_iters = LoopStripMiningIterShortLoop* ABS(stride);
const TypeInt* inner_iv_t = phase->type(inner_iv_phi)->is_int();
jlong iter_estimate = (jlong)inner_iv_t->_hi - (jlong)inner_iv_t->_lo;
assert(iter_estimate > 0, "broken");
- if ((jlong)scaled_iters != scaled_iters_long || iter_estimate <= scaled_iters_long / 10) {
+ if ((jlong)scaled_iters != scaled_iters_long || iter_estimate <= short_scaled_iters) {
// Remove outer loop and safepoint (too few iterations)
Node* outer_sfpt = le->in(0);
assert(outer_sfpt->Opcode() == Op_SafePoint, "broken outer loop");
diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp
--- a/src/share/vm/runtime/arguments.cpp
+++ b/src/share/vm/runtime/arguments.cpp
@@ -2641,6 +2641,10 @@
}
LoopStripMiningIter = 0;
}
+ if (FLAG_IS_DEFAULT(LoopStripMiningIterShortLoop)) {
+ // blind guess
+ LoopStripMiningIterShortLoop = LoopStripMiningIter / 10;
+ }
#endif
return status;
}
More information about the shenandoah-dev
mailing list