2112 closed_range_checks++;
2113 Node *exit = loop->is_loop_exit(iff);
2114 if( !exit ) continue;
2115 int flip = (exit->Opcode() == Op_IfTrue) ? 1 : 0;
2116
2117 // Get boolean condition to test
2118 Node *i1 = iff->in(1);
2119 if( !i1->is_Bool() ) continue;
2120 BoolNode *bol = i1->as_Bool();
2121 BoolTest b_test = bol->_test;
2122 // Flip sense of test if exit condition is flipped
2123 if( flip )
2124 b_test = b_test.negate();
2125
2126 // Get compare
2127 Node *cmp = bol->in(1);
2128
2129 // Look for trip_counter + offset vs limit
2130 Node *rc_exp = cmp->in(1);
2131 Node *limit = cmp->in(2);
2132 jint scale_con= 1; // Assume trip counter not scaled
2133
2134 Node *limit_c = get_ctrl(limit);
2135 if( loop->is_member(get_loop(limit_c) ) ) {
2136 // Compare might have operands swapped; commute them
2137 b_test = b_test.commute();
2138 rc_exp = cmp->in(2);
2139 limit = cmp->in(1);
2140 limit_c = get_ctrl(limit);
2141 if( loop->is_member(get_loop(limit_c) ) )
2142 continue; // Both inputs are loop varying; cannot RCE
2143 }
2144 // Here we know 'limit' is loop invariant
2145
2146 // 'limit' maybe pinned below the zero trip test (probably from a
2147 // previous round of rce), in which case, it can't be used in the
2148 // zero trip test expression which must occur before the zero test's if.
2149 if( limit_c == ctrl ) {
2150 continue; // Don't rce this check but continue looking for other candidates.
2151 }
2152
|
2112 closed_range_checks++;
2113 Node *exit = loop->is_loop_exit(iff);
2114 if( !exit ) continue;
2115 int flip = (exit->Opcode() == Op_IfTrue) ? 1 : 0;
2116
2117 // Get boolean condition to test
2118 Node *i1 = iff->in(1);
2119 if( !i1->is_Bool() ) continue;
2120 BoolNode *bol = i1->as_Bool();
2121 BoolTest b_test = bol->_test;
2122 // Flip sense of test if exit condition is flipped
2123 if( flip )
2124 b_test = b_test.negate();
2125
2126 // Get compare
2127 Node *cmp = bol->in(1);
2128
2129 // Look for trip_counter + offset vs limit
2130 Node *rc_exp = cmp->in(1);
2131 Node *limit = cmp->in(2);
2132 int scale_con= 1; // Assume trip counter not scaled
2133
2134 Node *limit_c = get_ctrl(limit);
2135 if( loop->is_member(get_loop(limit_c) ) ) {
2136 // Compare might have operands swapped; commute them
2137 b_test = b_test.commute();
2138 rc_exp = cmp->in(2);
2139 limit = cmp->in(1);
2140 limit_c = get_ctrl(limit);
2141 if( loop->is_member(get_loop(limit_c) ) )
2142 continue; // Both inputs are loop varying; cannot RCE
2143 }
2144 // Here we know 'limit' is loop invariant
2145
2146 // 'limit' maybe pinned below the zero trip test (probably from a
2147 // previous round of rce), in which case, it can't be used in the
2148 // zero trip test expression which must occur before the zero test's if.
2149 if( limit_c == ctrl ) {
2150 continue; // Don't rce this check but continue looking for other candidates.
2151 }
2152
|