> 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