@@ -2894,7 +2894,7 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree *loop, Node_List &old_new) {
2894
2894
limit_ctrl = ensure_node_and_inputs_are_above_pre_end (pre_end, limit);
2895
2895
2896
2896
// offset and limit could have control below new_limit_ctrl if they are not loop invariant in the pre loop.
2897
- new_limit_ctrl = dominated_node (new_limit_ctrl, offset_ctrl, limit_ctrl);
2897
+ Node* next_limit_ctrl = dominated_node (new_limit_ctrl, offset_ctrl, limit_ctrl);
2898
2898
2899
2899
#ifdef ASSERT
2900
2900
if (TraceRangeLimitCheck) {
@@ -2915,16 +2915,16 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree *loop, Node_List &old_new) {
2915
2915
jlong lscale_con = scale_con;
2916
2916
Node* int_offset = offset;
2917
2917
offset = new ConvI2LNode (offset);
2918
- register_new_node (offset, new_limit_ctrl );
2918
+ register_new_node (offset, next_limit_ctrl );
2919
2919
Node* int_limit = limit;
2920
2920
limit = new ConvI2LNode (limit);
2921
- register_new_node (limit, new_limit_ctrl );
2921
+ register_new_node (limit, next_limit_ctrl );
2922
2922
2923
2923
// Adjust pre and main loop limits to guard the correct iteration set
2924
2924
if (cmp->Opcode () == Op_CmpU) { // Unsigned compare is really 2 tests
2925
2925
if (b_test._test == BoolTest::lt) { // Range checks always use lt
2926
2926
// The underflow and overflow limits: 0 <= scale*I+offset < limit
2927
- add_constraint (stride_con, lscale_con, offset, zero, limit, new_limit_ctrl , &pre_limit, &main_limit);
2927
+ add_constraint (stride_con, lscale_con, offset, zero, limit, next_limit_ctrl , &pre_limit, &main_limit);
2928
2928
Node* init = cl->init_trip ();
2929
2929
Node* opaque_init = new OpaqueLoopInitNode (C, init);
2930
2930
register_new_node (opaque_init, loop_entry);
@@ -2977,22 +2977,22 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree *loop, Node_List &old_new) {
2977
2977
// Convert (I*scale+offset) >= Limit to (I*(-scale)+(-offset)) <= -Limit
2978
2978
lscale_con = -lscale_con;
2979
2979
offset = new SubLNode (zero, offset);
2980
- register_new_node (offset, new_limit_ctrl );
2980
+ register_new_node (offset, next_limit_ctrl );
2981
2981
limit = new SubLNode (zero, limit);
2982
- register_new_node (limit, new_limit_ctrl );
2982
+ register_new_node (limit, next_limit_ctrl );
2983
2983
// Fall into LE case
2984
2984
case BoolTest::le:
2985
2985
if (b_test._test != BoolTest::gt) {
2986
2986
// Convert X <= Y to X < Y+1
2987
2987
limit = new AddLNode (limit, one);
2988
- register_new_node (limit, new_limit_ctrl );
2988
+ register_new_node (limit, next_limit_ctrl );
2989
2989
}
2990
2990
// Fall into LT case
2991
2991
case BoolTest::lt:
2992
2992
// The underflow and overflow limits: MIN_INT <= scale*I+offset < limit
2993
2993
// Note: (MIN_INT+1 == -MAX_INT) is used instead of MIN_INT here
2994
2994
// to avoid problem with scale == -1: MIN_INT/(-1) == MIN_INT.
2995
- add_constraint (stride_con, lscale_con, offset, mini, limit, new_limit_ctrl , &pre_limit, &main_limit);
2995
+ add_constraint (stride_con, lscale_con, offset, mini, limit, next_limit_ctrl , &pre_limit, &main_limit);
2996
2996
break ;
2997
2997
default :
2998
2998
if (PrintOpto) {
@@ -3001,6 +3001,9 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree *loop, Node_List &old_new) {
3001
3001
continue ; // Unhandled case
3002
3002
}
3003
3003
}
3004
+ // Only update variable tracking control for new nodes if it's indeed a range check that can be eliminated (and
3005
+ // limits are updated)
3006
+ new_limit_ctrl = next_limit_ctrl;
3004
3007
3005
3008
// Kill the eliminated test
3006
3009
C->set_major_progress ();
1 commit comments
openjdk-notifier[bot] commentedon Oct 21, 2024
Review
Issues