This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, dataflow] PR47525 DCE fails to eliminate dead calls to pure functions


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
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]