https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107767
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Richard Biener from comment #10) > Looks like a general CFG optimization if we have N forwarders to a PHI with > the same value then we can merge them to one (it's enough to have a single > forwarder which we can use as the remaining one even). Note that's kind-of > a reverse > mergephi for same values. > > PHI <a, b, c, c> > > -> > > forwarder > | > PHI <a, b, c> > > CFG cleanup will then eventually elide forwarders into the added forwarder. Are those actually forwarder blocks though? Doesn't the GIMPLE_PREDICT statement at the start of each one of them prevent tree_forwarder_block_p from returning true? As a hack I've removed them manually: FOR_EACH_BB_FN (bb, cfun) { gimple_stmt_iterator gsi = gsi_after_labels (bb); if (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_PREDICT) gsi_remove (&gsi, true); } in pass_if_to_switch::execute before return TODO_cleanup_cfg;, but that didn't help.