Hi, > On Mon, Jul 17, 2017 at 10:27 AM, Jan Hubicka <hubi...@ucw.cz> wrote: > >> Hi all, > >> > >> This is a new version of previous patch > >> (https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00020.html), fixed > >> after Rainer's remarks. > > Hi, > > the patch looks OK, but I wonder why you included can_be_discarded check? > > If function is in comdat I believe the optimization still can happen. > > Perhaps you only want to check DECL_EXTERNAL? > > TBH I was inspired by can_replace_by_local_alias which prohibits local > alias for discardable functions. But I agree that situation here is > different and it's indeed not needed (if function is discarded, it > does not matter whether we optimized recursive calls). > > Could you elaborate why we still need DECL_EXTERNAL though?
I you have DECL_EXTERNAl function, its definition lives only until inlining and then all offline copies are replaced by external calls. So if you create alias for recusive call you will probably end up with an ICE. Honza > > -Y