Kenneth Zadeck <zadeck@naturalbridge.com> writes:
This patch was developed by Ian from a bug that Danny and I hit when we were moving the web pass after combine. The bug appears to be a silent failure when web is either not run or run before combine.
Combine incorrectly modifies the mode of a register if the moon and
several planets are in the correct alignment. The patch was tested two
ways. The bug disappears on ppc-suse-linux and
x86_64-unknown-linux-gnu when using a lot of experimental code.
To clarify a bit, there is code in combine to change the mode of a
pseudo-register, when profitable, if the register is set only once;
see can_change_dest_mode. However the test in can_change_dest_mode
does not consider that the pseudo-register might appear in REG_EQUAL
notes. There is an attempt to fix up that case in distribute_notes,
but it doesn't catch all possibilities. Most obviously it doesn't
catch the case where the insn with the note is not combined with
anything, and hence the notes are never passed to distribute_notes.
The bug can be seen by looking at debugging dumps. After combine the
same pseudo-register appears with one mode in the insn and with
another mode in a REG_EQUAL note.
We keep a canonical version of each pseudo-register in the
regno_reg_rtx array, so it is easy to update every use of the
pseudo-register by updating that array. The old code used to simply
replace the entry in the array, which of course did not affect other
existing uses. This patch changes it to directly modify the entry in
the array, by slightly extending the existing combine undo mechanism.
Since I wrote this patch, it looks good to me. I'll approve it, but
please wait 48 hours to commit to see if there are any comments.
2006-01-09 Ian Taylors <ian@airs.com>
ChangeLog entry should be "Ian Lance Taylor"--see ChangeLog-2005 for
examples.
Thanks for testing it.
Ian