This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: [tree-ssa] fix REG_DEAD notes
- From: Dale Johannesen <dalej at apple dot com>
- To: gcc-patches Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Dale Johannesen <dalej at apple dot com>
- Date: Wed, 25 Feb 2004 10:34:49 -0800
- Subject: Patch: [tree-ssa] fix REG_DEAD notes
On Darwin with -mpowerpc64, the call in the following example
extern unsigned long long lseek (int, unsigned long long, int);
unsigned long long x;
int foo(int f, int z) {
return lseek(f,x,z);
}
both uses and resets R3. gcc is not consistent about whether a REG_DEAD
note is applied in this case; life_analysis does not apply one, but
combine
does, under some conditions. This leads to an ICE in the scheduler,
which deletes all the REG_DEAD notes coming from combine, then
recomputes them later using life analysis, and expects the totals to
match. This patch changes combine to be consistent with life_analysis.
Bootstrapped and tested on Darwin.
(The ICE occurs only with tree-ssa, because on mainline the merge of
the two-word return value into one register goes through memory, and
nobody is smart enough to use a register instead, and the bug is not
tickled. The tree-ssa optimizations cause the merge to be done in a
register, and combine eventually realizes all it needs to do is return
R4
and R3 is dead. A great improvement.)
There is already a testcase, gcc.dg/macho-lo-sum.c, which demonstrates
the bug; it ICEd before and passes with my patch. I won't be adding
another testcase.
2004-02-24 Dale Johannesen <dalej@apple.com>
* combine.c (distribute_notes): Do not place a REG_DEAD note
when value is both set and used.
Attachment:
combinepatch.txt
Description: Text document