This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR83648
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <rguenther at suse dot de>, Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>, gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 3 Jan 2018 12:35:20 +0100
- Subject: Re: PR83648
- Authentication-results: sourceware.org; auth=none
- References: <CAAgBjMnap+eF165TdbZrpAmU2=stko03z0OOzsHwd_Bca+MN9g@mail.gmail.com> <970CBBC7-6AFE-4A52-BC5F-9DAD51984038@suse.de> <20180103091028.GZ1833@tucnak>
> On Wed, Jan 03, 2018 at 10:05:30AM +0100, Richard Biener wrote:
> > >One concern I have is that with the patch, malloc_candidate_p will
> > >return true if all the args to PHI are NULL:
> > >retval = PHI<0, 0>
> > >return retval
> > >
> > >However I expect that PHI with all 0 args would be constant folded to
> > >0 earlier, so this case shouldn't occur in practice ?
> >
> > You may not rely on folding for correctness.
.. and at this level i would say even for code quality. Early optimizers are
facing a lot of garbage and they are not repeated, so we get code at various
intermediate levels of optimizations thorugh the IPA queue.
Honza
>
> Yeah. Will the patch handle (I mean punt on) also unfolded
> if (n) ? 0 : __builtin_malloc (n);
> and similar?
>
> Jakub