This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: calculate_global_regs_live


> Ok.  It turns out that we need more as you correctly supposed: we really
> need to clear the regsets at the top of the loop.

Well, it turns out that this doesn't work either: by doing so, we may clear 
the liveness information on a BB which will not be processed by 
calculate_global_regs_live because it is not referenced in 'blocks', thus 
causing a checking failure in verify_wide_reg later.  And I think Richard's 
patch might be questionable for the very same reason.

I think the situation is rather messy:
- to be sure that calculate_global_regs_live will terminate, we need to make 
it so that GLOBAL_LIVE_AT_START never shrinks for any modified BB.  This 
means in practice that we need to clear GLOBAL_LIVE_AT_START before entering 
calculate_global_regs_live for any BB that will be modified;
- as I said above, if GLOBAL_LIVE_AT_START is cleared for a BB that will not 
be modified, we'll run into problems during later passes;
- so we need to clear GLOBAL_LIVE_AT_START for the exact set of BBs that will 
be modified;
- when 'blocks' is non-zero, the set of BBs that will be modified may be a 
strict superset of 'blocks', unless 'blocks' contains all BBs.  And we don't 
have this information before calling calculate_global_regs_live.

Hence the conclusion: we need to always clear GLOBAL_LIVE_AT_START for all 
BBs and always recalculate it for all BBs.  This means that 'blocks' must 
contain all BBs as soon as 'extent' is not UPDATE_LIFE_LOCAL in 
update_life_info.  With probably an effect on compile-time.

However, given that infinite loops in calculate_global_regs_live appear to be 
seldom seen in practice, we might want to use only a partial solution: 
clearing GLOBAL_LIVE_AT_START at the top of the loop only for BBs that are 
referenced in 'blocks'.  This is enough to fix PR opt/12158 and we are 
guaranteed not to wrongly clear liveness information.  But, of course, this 
still doesn't guarantee that calculate_global_regs_live will always 
terminate, only that there are fewer chances it won't.

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]