This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RS6000] fix for RTL cprop vs. fixed hard regs
- From: David Edelsohn <dje dot gcc at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 1 Feb 2015 20:34:08 -0500
- Subject: Re: [RS6000] fix for RTL cprop vs. fixed hard regs
- Authentication-results: sourceware.org; auth=none
- References: <20150116094227 dot GV23768 at bubble dot grove dot modra dot org> <20150130065713 dot GF14796 at bubble dot grove dot modra dot org>
On Fri, Jan 30, 2015 at 1:57 AM, Alan Modra <amodra@gmail.com> wrote:
> On Fri, Jan 16, 2015 at 08:12:27PM +1030, Alan Modra wrote:
>> https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-December/123776.html
>> shows gcc-5 miscompiling a powerpc64 linux kernel. The executive
>> summary is that the rs6000 backend has a bug in its RTL description of
>> indirect calls. We specify a parallel containing both the actual call
>> and an action that happens after the call, the restore of r2. The
>> restore is simply a memory load:
>> (set (reg:DI 2 2)
>> (mem/v/c:DI (plus:DI (reg/f:DI 1 1)
>> (const_int 40 [0x28])) [0 S8 A8]))
>> This leads to cprop concluding that it is valid to replace the
>> reference to r1 with another register having the same value before the
>> call. Unfortunately, sometimes a call-clobbered register is chosen.
>
> This is the rs6000 backend fix. Bootstrapped etc. powerpc64-linux.
> OK to apply?
>
> gcc/
> * config/rs6000/rs6000.c (rs6000_call_aix): Use unspec rather
> than mem for toc_restore.
> * config/rs6000/rs6000.md (UNSPEC_TOCSLOT): Define.
Please insert UNSPEC_TOCSLOT in the UNSPEC list after UNSPEC_TOCPTR
and UNSPEC_TOC and add a short comment like the other two.
> (call_indirect_aix, call_value_indirect_aix): Adjust to suit.
> (call_indirect_elfv2, call_value_indirect_elfv2): Likewise.
> gcc/testsuite/
> * gcc.target/powerpc/cprophard.c: New.
Okay with that change.
Thanks, David