This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/34503] Issues with constant/copy propagation implementation in gcse.c
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 May 2008 14:31:47 -0000
- Subject: [Bug rtl-optimization/34503] Issues with constant/copy propagation implementation in gcse.c
- References: <bug-34503-280@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from steven at gcc dot gnu dot org 2008-05-24 14:31 -------
I have found a test case for the issue mentioned in comment #4. And it comes
from gcc itself:
static int *free_phinodes[10 - 2]; /* was 'tree' */
static unsigned long free_phinode_count;
void
init_phinodes (void)
{
int i;
for (i = 0; i < 10 - 2; i++)
free_phinodes[i] = ((void *)0);
free_phinode_count = 0
}
When compiling this on powerpc-unknown-elf with r135815 and with the options
"-O2 -fdump-rtl-gcse1-slim", I get the following RTL at the end of the GCSE
pass:
37 NOTE_INSN_BASIC_BLOCK
36 NOTE_INSN_FUNCTION_BEG
39 r164:SI=high(`*.LANCHOR0')
40 r166:SI=r164:SI+low(`*.LANCHOR0')
REG_DEAD: r164:SI
REG_EQUAL: `*.LANCHOR0'
75 r153:SI=r166:SI
REG_EQUAL: `*.LANCHOR0'
73 r165:SI=r166:SI+0x20
REG_DEAD: r167:SI
REG_EQUAL: const(`*.LANCHOR0'+0x20)
L46:
42 NOTE_INSN_BASIC_BLOCK
43 r156:SI=0x0
44 [r153:SI]=r156:SI
REG_EQUAL: 0x0
45 r153:SI=r153:SI+0x4
71 r157:SI=r166:SI
REG_EQUAL: `*.LANCHOR0'
50 r160:CC=cmp(r153:SI,r165:SI)
REG_EQUAL: cmp(r153:SI,const(`*.LANCHOR0'+0x20))
51 pc={(r160:CC!=0x0)?L46:pc}
REG_DEAD: r160:CC
REG_BR_PROB: 0x222e
52 NOTE_INSN_BASIC_BLOCK
56 [r157:SI+0x20]=r156:SI
REG_DEAD: r157:SI
REG_DEAD: r156:SI
REG_EQUAL: 0x0
This is the dump *after* CPROP2, so the post-PRE-GCSE const/copy pass has run.
Note the REG_EQUAL note on insn 71: "r157:SI=r166:SI {REG_EQUAL:
`*.LANCHOR0'}". This is a reg-reg copy insn, but CPROP2 does not record the
copy. Instead it records that r157 is equal to the REG_EQUAL note value. The
result is that CPROP2 fails to copy propagate r166 into insn 56 (where r157
reaches and dies, so the copy propagation would eliminate r157).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34503