> > Yes. Also affecting other statements isn't allowed. > > >One would need to also unlink vdefs and release the vdef SSA_NAME, and > >not > >sure if fold_stmt_inplace callers would be even prepared for the stmt > >to > >become noreturn, and no longer throwing, etc. > > That I think they have to. Vdef handling is done by the caller which is > required to update_stmt and to remove eh side effects if required. > > >What would be the advantages of doing all that over the posted patch? > > Not sure why this transform is in fold at all rather than in a pass that > expects this kind of control flow changes.
It was always in fold. I wonder what happens when you do the same w/o devirt machinery? I.e. take function pointer to __builtin_unreachable and call it with a return value + parameters? Honza