https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123518

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 63308
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63308&action=edit
Patch which removes the degenerated phis after the fact

This patch works for the most part. Except ipa-fnsummary calls
loop_optimizer_init (LOOPS_NORMAL | LOOPS_HAVE_RECORDED_EXITS) which adds a
forwarder header for either pre-header or latches. and since the cgraph is not
updated for the new phi node nor updated for the removal of the "old" one
either; we get a crash.

I have not checked if using just AVOID_CFG_MODIFICATIONS works here.
This is why this is for GCC 17 at this stage.
I tried to changing loop_optimizer_init to be happen in the local fnsummary too
but then we get crashes in srub pass; as that does not update the loop
structure correctly (maybe I need some other changes there too).

I also not a fan of creating the phi and then only deleting it but I can't
think of a better way here really.

Reply via email to