Lines 3998-4003
dead_or_predicable (basic_block test_bb,
Link Here
|
3998 |
basic_block other_bb, basic_block new_dest, int reversep) |
3998 |
basic_block other_bb, basic_block new_dest, int reversep) |
3999 |
{ |
3999 |
{ |
4000 |
rtx head, end, jump, earliest = NULL_RTX, old_dest, new_label = NULL_RTX; |
4000 |
rtx head, end, jump, earliest = NULL_RTX, old_dest, new_label = NULL_RTX; |
|
|
4001 |
bitmap merge_set = NULL, merge_set_noclobber = NULL; |
4001 |
/* Number of pending changes. */ |
4002 |
/* Number of pending changes. */ |
4002 |
int n_validated_changes = 0; |
4003 |
int n_validated_changes = 0; |
4003 |
|
4004 |
|
Lines 4086-4091
dead_or_predicable (basic_block test_bb,
Link Here
|
4086 |
earliest = jump; |
4087 |
earliest = jump; |
4087 |
} |
4088 |
} |
4088 |
#endif |
4089 |
#endif |
|
|
4090 |
|
4089 |
/* Try the NCE path if the CE path did not result in any changes. */ |
4091 |
/* Try the NCE path if the CE path did not result in any changes. */ |
4090 |
if (n_validated_changes == 0) |
4092 |
if (n_validated_changes == 0) |
4091 |
{ |
4093 |
{ |
Lines 4094-4102
dead_or_predicable (basic_block test_bb,
Link Here
|
4094 |
that any registers modified are dead at the branch site. */ |
4096 |
that any registers modified are dead at the branch site. */ |
4095 |
|
4097 |
|
4096 |
rtx insn, cond, prev; |
4098 |
rtx insn, cond, prev; |
4097 |
bitmap merge_set, merge_set_noclobber, test_live, test_set; |
4099 |
bitmap test_live, test_set; |
4098 |
unsigned i, fail = 0; |
4100 |
bool intersect = false; |
4099 |
bitmap_iterator bi; |
|
|
4100 |
|
4101 |
|
4101 |
/* Check for no calls or trapping operations. */ |
4102 |
/* Check for no calls or trapping operations. */ |
4102 |
for (insn = head; ; insn = NEXT_INSN (insn)) |
4103 |
for (insn = head; ; insn = NEXT_INSN (insn)) |
Lines 4138-4149
dead_or_predicable (basic_block test_bb,
Link Here
|
4138 |
|
4139 |
|
4139 |
merge_set = BITMAP_ALLOC (®_obstack); |
4140 |
merge_set = BITMAP_ALLOC (®_obstack); |
4140 |
merge_set_noclobber = BITMAP_ALLOC (®_obstack); |
4141 |
merge_set_noclobber = BITMAP_ALLOC (®_obstack); |
4141 |
test_live = BITMAP_ALLOC (®_obstack); |
|
|
4142 |
test_set = BITMAP_ALLOC (®_obstack); |
4143 |
|
4142 |
|
4144 |
/* ??? bb->local_set is only valid during calculate_global_regs_live, |
|
|
4145 |
so we must recompute usage for MERGE_BB. Not so bad, I suppose, |
4146 |
since we've already asserted that MERGE_BB is small. */ |
4147 |
/* If we allocated new pseudos (e.g. in the conditional move |
4143 |
/* If we allocated new pseudos (e.g. in the conditional move |
4148 |
expander called from noce_emit_cmove), we must resize the |
4144 |
expander called from noce_emit_cmove), we must resize the |
4149 |
array first. */ |
4145 |
array first. */ |
Lines 4164-4180
dead_or_predicable (basic_block test_bb,
Link Here
|
4164 |
if (! reload_completed |
4160 |
if (! reload_completed |
4165 |
&& targetm.small_register_classes_for_mode_p (VOIDmode)) |
4161 |
&& targetm.small_register_classes_for_mode_p (VOIDmode)) |
4166 |
{ |
4162 |
{ |
|
|
4163 |
unsigned i; |
4164 |
bitmap_iterator bi; |
4165 |
|
4167 |
EXECUTE_IF_SET_IN_BITMAP (merge_set_noclobber, 0, i, bi) |
4166 |
EXECUTE_IF_SET_IN_BITMAP (merge_set_noclobber, 0, i, bi) |
4168 |
{ |
4167 |
{ |
4169 |
if (i < FIRST_PSEUDO_REGISTER |
4168 |
if (i < FIRST_PSEUDO_REGISTER |
4170 |
&& ! fixed_regs[i] |
4169 |
&& ! fixed_regs[i] |
4171 |
&& ! global_regs[i]) |
4170 |
&& ! global_regs[i]) |
4172 |
fail = 1; |
4171 |
goto fail; |
4173 |
} |
4172 |
} |
4174 |
} |
4173 |
} |
4175 |
|
4174 |
|
4176 |
/* For TEST, we're interested in a range of insns, not a whole block. |
4175 |
/* For TEST, we're interested in a range of insns, not a whole block. |
4177 |
Moreover, we're interested in the insns live from OTHER_BB. */ |
4176 |
Moreover, we're interested in the insns live from OTHER_BB. */ |
|
|
4177 |
test_live = BITMAP_ALLOC (®_obstack); |
4178 |
test_set = BITMAP_ALLOC (®_obstack); |
4178 |
|
4179 |
|
4179 |
/* The loop below takes the set of live registers |
4180 |
/* The loop below takes the set of live registers |
4180 |
after JUMP, and calculates the live set before EARLIEST. */ |
4181 |
after JUMP, and calculates the live set before EARLIEST. */ |
Lines 4195-4217
dead_or_predicable (basic_block test_bb,
Link Here
|
4195 |
/* We can perform the transformation if |
4196 |
/* We can perform the transformation if |
4196 |
MERGE_SET_NOCLOBBER & TEST_SET |
4197 |
MERGE_SET_NOCLOBBER & TEST_SET |
4197 |
and |
4198 |
and |
4198 |
MERGE_SET & TEST_LIVE) |
4199 |
MERGE_SET & TEST_LIVE |
4199 |
and |
4200 |
and |
4200 |
TEST_SET & DF_LIVE_IN (merge_bb) |
4201 |
TEST_SET & DF_LIVE_IN (merge_bb) |
4201 |
are empty. */ |
4202 |
are empty. */ |
4202 |
|
4203 |
|
4203 |
if (bitmap_intersect_p (test_set, merge_set_noclobber) |
4204 |
if (bitmap_intersect_p (merge_set_noclobber, test_set) |
4204 |
|| bitmap_intersect_p (test_live, merge_set) |
4205 |
|| bitmap_intersect_p (merge_set, test_live) |
4205 |
|| bitmap_intersect_p (test_set, df_get_live_in (merge_bb))) |
4206 |
|| bitmap_intersect_p (test_set, df_get_live_in (merge_bb))) |
4206 |
fail = 1; |
4207 |
intersect = true; |
4207 |
|
4208 |
|
4208 |
BITMAP_FREE (merge_set_noclobber); |
|
|
4209 |
BITMAP_FREE (merge_set); |
4210 |
BITMAP_FREE (test_live); |
4209 |
BITMAP_FREE (test_live); |
4211 |
BITMAP_FREE (test_set); |
4210 |
BITMAP_FREE (test_set); |
4212 |
|
4211 |
|
4213 |
if (fail) |
4212 |
if (intersect) |
4214 |
return FALSE; |
4213 |
goto fail; |
4215 |
} |
4214 |
} |
4216 |
|
4215 |
|
4217 |
no_body: |
4216 |
no_body: |
Lines 4261-4268
dead_or_predicable (basic_block test_bb,
Link Here
|
4261 |
if (end == BB_END (merge_bb)) |
4260 |
if (end == BB_END (merge_bb)) |
4262 |
BB_END (merge_bb) = PREV_INSN (head); |
4261 |
BB_END (merge_bb) = PREV_INSN (head); |
4263 |
|
4262 |
|
4264 |
/* PR 21767: When moving insns above a conditional branch, REG_EQUAL |
4263 |
/* PR 21767: when moving insns above a conditional branch, the REG_EQUAL |
4265 |
notes might become invalid. */ |
4264 |
notes being moved might become invalid. */ |
4266 |
insn = head; |
4265 |
insn = head; |
4267 |
do |
4266 |
do |
4268 |
{ |
4267 |
{ |
Lines 4279-4284
dead_or_predicable (basic_block test_bb,
Link Here
|
4279 |
remove_note (insn, note); |
4278 |
remove_note (insn, note); |
4280 |
} while (insn != end && (insn = NEXT_INSN (insn))); |
4279 |
} while (insn != end && (insn = NEXT_INSN (insn))); |
4281 |
|
4280 |
|
|
|
4281 |
/* PR46315: when moving insns above a conditional branch, the REG_EQUAL |
4282 |
notes referring to the registers being set might become invalid. */ |
4283 |
if (merge_set) |
4284 |
{ |
4285 |
unsigned i; |
4286 |
bitmap_iterator bi; |
4287 |
|
4288 |
EXECUTE_IF_SET_IN_BITMAP (merge_set_noclobber, 0, i, bi) |
4289 |
remove_reg_equal_equiv_notes_for_regno (i); |
4290 |
|
4291 |
BITMAP_FREE (merge_set); |
4292 |
BITMAP_FREE (merge_set_noclobber); |
4293 |
} |
4294 |
|
4282 |
reorder_insns (head, end, PREV_INSN (earliest)); |
4295 |
reorder_insns (head, end, PREV_INSN (earliest)); |
4283 |
} |
4296 |
} |
4284 |
|
4297 |
|
Lines 4295-4300
dead_or_predicable (basic_block test_bb,
Link Here
|
4295 |
|
4308 |
|
4296 |
cancel: |
4309 |
cancel: |
4297 |
cancel_changes (0); |
4310 |
cancel_changes (0); |
|
|
4311 |
fail: |
4312 |
if (merge_set) |
4313 |
{ |
4314 |
BITMAP_FREE (merge_set); |
4315 |
BITMAP_FREE (merge_set_noclobber); |
4316 |
} |
4298 |
return FALSE; |
4317 |
return FALSE; |
4299 |
} |
4318 |
} |
4300 |
|
4319 |
|