Skip to content

Commit 3559eec

Browse files
author
Hamlin Li
committed
8373428: Refine variables with the same name in nested scopes in PhaseChaitin::gather_lrg_masks
Reviewed-by: phh
1 parent ad6611a commit 3559eec

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/hotspot/share/opto/chaitin.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,8 +1076,8 @@ void PhaseChaitin::gather_lrg_masks( bool after_aggressive ) {
10761076

10771077
// Prepare register mask for each input
10781078
for( uint k = input_edge_start; k < cnt; k++ ) {
1079-
uint vreg = _lrg_map.live_range_id(n->in(k));
1080-
if (!vreg) {
1079+
uint vreg_in = _lrg_map.live_range_id(n->in(k));
1080+
if (!vreg_in) {
10811081
continue;
10821082
}
10831083

@@ -1099,7 +1099,7 @@ void PhaseChaitin::gather_lrg_masks( bool after_aggressive ) {
10991099
if (k >= cur_node->num_opnds()) continue;
11001100
}
11011101

1102-
LRG &lrg = lrgs(vreg);
1102+
LRG &lrg_in = lrgs(vreg_in);
11031103
// // Testing for floating point code shape
11041104
// Node *test = n->in(k);
11051105
// if( test->is_Mach() ) {
@@ -1114,25 +1114,25 @@ void PhaseChaitin::gather_lrg_masks( bool after_aggressive ) {
11141114
// Do not limit registers from uncommon uses before
11151115
// AggressiveCoalesce. This effectively pre-virtual-splits
11161116
// around uncommon uses of common defs.
1117-
const RegMask &rm = n->in_RegMask(k);
1117+
const RegMask &rm_in = n->in_RegMask(k);
11181118
if (!after_aggressive && _cfg.get_block_for_node(n->in(k))->_freq > 1000 * block->_freq) {
11191119
// Since we are BEFORE aggressive coalesce, leave the register
11201120
// mask untrimmed by the call. This encourages more coalescing.
11211121
// Later, AFTER aggressive, this live range will have to spill
11221122
// but the spiller handles slow-path calls very nicely.
11231123
} else {
1124-
lrg.and_with(rm);
1124+
lrg_in.and_with(rm_in);
11251125
}
11261126

11271127
// Check for bound register masks
1128-
const RegMask &lrgmask = lrg.mask();
1128+
const RegMask &lrgmask_in = lrg_in.mask();
11291129
uint kreg = n->in(k)->ideal_reg();
11301130
bool is_vect = RegMask::is_vector(kreg);
11311131
assert(n->in(k)->bottom_type()->isa_vect() == nullptr || is_vect ||
11321132
kreg == Op_RegD || kreg == Op_RegL || kreg == Op_RegVectMask,
11331133
"vector must be in vector registers");
1134-
if (lrgmask.is_bound(kreg))
1135-
lrg._is_bound = 1;
1134+
if (lrgmask_in.is_bound(kreg))
1135+
lrg_in._is_bound = 1;
11361136

11371137
// If this use of a double forces a mis-aligned double,
11381138
// flag as '_fat_proj' - really flag as allowing misalignment
@@ -1141,30 +1141,30 @@ void PhaseChaitin::gather_lrg_masks( bool after_aggressive ) {
11411141
// FOUR registers!
11421142
#ifdef ASSERT
11431143
if (is_vect && !_scheduling_info_generated) {
1144-
if (lrg.num_regs() != 0) {
1145-
assert(lrgmask.is_aligned_sets(lrg.num_regs()), "vector should be aligned");
1146-
assert(!lrg._fat_proj, "sanity");
1147-
assert(RegMask::num_registers(kreg) == lrg.num_regs(), "sanity");
1144+
if (lrg_in.num_regs() != 0) {
1145+
assert(lrgmask_in.is_aligned_sets(lrg_in.num_regs()), "vector should be aligned");
1146+
assert(!lrg_in._fat_proj, "sanity");
1147+
assert(RegMask::num_registers(kreg) == lrg_in.num_regs(), "sanity");
11481148
} else {
11491149
assert(n->is_Phi(), "not all inputs processed only if Phi");
11501150
}
11511151
}
11521152
#endif
1153-
if (!is_vect && lrg.num_regs() == 2 && !lrg._fat_proj && rm.is_misaligned_pair()) {
1154-
lrg._fat_proj = 1;
1155-
lrg._is_bound = 1;
1153+
if (!is_vect && lrg_in.num_regs() == 2 && !lrg_in._fat_proj && rm_in.is_misaligned_pair()) {
1154+
lrg_in._fat_proj = 1;
1155+
lrg_in._is_bound = 1;
11561156
}
11571157
// if the LRG is an unaligned pair, we will have to spill
11581158
// so clear the LRG's register mask if it is not already spilled
11591159
if (!is_vect && !n->is_SpillCopy() &&
1160-
(lrg._def == nullptr || lrg.is_multidef() || !lrg._def->is_SpillCopy()) &&
1161-
lrgmask.is_misaligned_pair()) {
1162-
lrg.clear();
1160+
(lrg_in._def == nullptr || lrg_in.is_multidef() || !lrg_in._def->is_SpillCopy()) &&
1161+
lrgmask_in.is_misaligned_pair()) {
1162+
lrg_in.clear();
11631163
}
11641164

11651165
// Check for maximum frequency value
1166-
if (lrg._maxfreq < block->_freq) {
1167-
lrg._maxfreq = block->_freq;
1166+
if (lrg_in._maxfreq < block->_freq) {
1167+
lrg_in._maxfreq = block->_freq;
11681168
}
11691169

11701170
} // End for all allocated inputs

0 commit comments

Comments
 (0)