This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Invalid shortcut in calculate_global_regs_live
- To: gcc at gcc dot gnu dot org
- Subject: Re: Invalid shortcut in calculate_global_regs_live
- From: Bernd Schmidt <bernds at redhat dot com>
- Date: Thu, 23 Nov 2000 18:45:17 +0000 (GMT)
- cc: rth at redhat dot com
I just wrote:
> This appears to be incorrect in the presence of conditional execution.
> If the block conditionally kills a register, there's no "right" value
> for the local_set regset; i.e. we can't apply the shortcut.
That's nonsense, I misread the code.
The actual problem seems to be as follows:
Consider a block that looks like this:
block A:
(cond_exec (pred) (set (reg 1) (foo)))
(if (pred) (goto block C)
block B:
....
block C:
....
At the beginning, global_live_at_start does not contain reg 1 for either
block B or C.
After the first iteration, it becomes live at the start of block C. This
means that it is merged into the global_live_at_end set of block A. The
set has changed, but reg 1 is in local_set for this block, so we must rescan.
Since the condition of the set matches the condition of the branch to C, we
are smart enough to figure out that the register isn't live at the start of
A.
After the second iteration, reg 1 also becomes live at the start of block B.
However, now we do not recognize a change in global_live_at_end of block A:
the set is unchanged, so we find no reason to rescan. This is incorrect; the
register must now be marked as live at the start of A.
Bernd