This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, dataflow] PR47525 DCE fails to eliminate dead calls to pure functions
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: Peter Bergner <bergner at vnet dot ibm dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Kenneth Zadeck <zadeck at naturalbridge dot com>
- Date: Mon, 31 Jan 2011 13:21:22 +0100
- Subject: Re: [PATCH, dataflow] PR47525 DCE fails to eliminate dead calls to pure functions
- References: <1296255975.2625.41.camel@otta> <AANLkTi=gWbWa0bA4GgBB39yuO=2=6H_JpKXf_oL89rZs@mail.gmail.com>
On Sat, Jan 29, 2011 at 11:54 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
> On Sat, Jan 29, 2011 at 00:06, Peter Bergner <bergner@vnet.ibm.com> wrote:
>> Tracking down some test suite failures while doing a --with-cpu=power7 build,
>> I noticed that DCE is no longer eliminating dead calls to const or pure
>> function calls. ?This is due to all global registers being added to every
>> call's use and def chains, even though const functions won't reference them
>> at all and pure functions won't set them.
>>
>> The following patch fixes that and has bootstrapped and regtested with
>> no regressions. ?This is a regression since it works in gcc 4.3, but
>> fails in gcc 4.4, 4.5 and trunk, but I understand it only a performance
>> issue and not a correctness issue.
>>
>> Is that patch OK? ?If so, do we want this in mainline now or after 4.6
>> has branched?
>
> Since this is a regression, ok for 4.6 but please bootstrap it on an
> x86 machine too just for the sake of coverage.
I don't think the testcase is valid.
extern int link_failure (int) __attribute__ ((pure));
extern void no_return (void) __attribute__ ((noreturn,pure));
int
main (void)
{
if (link_failure (0) < 1)
no_return ();
return 0;
}
no_return might be implemented as
no_return() { while (1);}
which means we can't DCE either call.
Richard.
> Paolo
>