This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR63404, gcc 5 miscompiles linux block layer
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Jeff Law <law at redhat dot com>, Richard Henderson <rth at redhat dot com>, Jiong Wang <Jiong dot Wang at arm dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 30 Sep 2014 17:51:32 +0100
- Subject: Re: [PATCH] PR63404, gcc 5 miscompiles linux block layer
- Authentication-results: sourceware.org; auth=none
- References: <5429A102 dot 4000602 at arm dot com> <5429A5D9 dot 9040404 at redhat dot com> <542ABAFF dot 2090206 at arm dot com> <542ADE36 dot 5010302 at redhat dot com>
On 30/09/14 17:45, Jeff Law wrote:
> On 09/30/14 08:15, Richard Earnshaw wrote:
>>
>> I think part of the problem is in the naming of single_set(). From the
>> name it's not entirely obvious to users that this includes insns that
>> clobber registers or which write other registers that are unused after
>> that point. I've previously had to fix a bug where this assumption was
>> made (eg https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54300)
>>
>> Most uses of single_set prior to register allocation are probably safe;
>> but later uses are fraught with potential problems of this nature and
>> may well be bugs waiting to happen.
> Very possibly. There's a bit of a natural tension here in that often we
> don't much care about the additional CLOBBERS, but when we get it wrong,
> obviously it's bad.
>
> I haven't done any research, but I suspect the change it ignore clobbers
> in single_set came in as part of exposing the CC register and avoiding
> regressions all over the place as a result.
It's not just clobbers; it ignores patterns like
(parallel
[(set (a) (...)
(set (b) (...)])
[(reg_note (reg_unused(b))]
Which is probably fine before register allocation but definitely
something you have to think about afterwards.
>
> I wonder what would happen if we ignored prior to register allocation,
> then rejected insns with those CLOBBERs once register allocation started.
>
Might work; but it might miss some useful cases as well...
R.