https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109442
--- Comment #29 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jan Hubicka <hubi...@gcc.gnu.org>: https://gcc.gnu.org/g:cee7d080d5c2a5fb8125878998b742c040ec88b4 commit r15-5336-gcee7d080d5c2a5fb8125878998b742c040ec88b4 Author: Jan Hubicka <hubi...@ucw.cz> Date: Sat Nov 16 14:04:32 2024 +0100 Ignore conditions guarding __builtin_unreachable in inliner metrics This extends my last year attempt to make inliner metric ignore conditionals guarding __builtin_unreachable. Compared to previous patch, this one implements a "mini-dce" in ipa-fnsummary to avoid accounting all statements that are only used to determine conditionals guarding __builtin_unnecesary. These will be removed later once value ranges are determined. While working on this, I noticed that we do have a lot of dead code while computing fnsummary for early inline. Those are only used to apply large-function growth, but it seems there is enough dead code to make this valud kind of irrelevant. Also there seems to be quite a lot of const/pure calls that can be cheaply removed before we inline them. So I wonder if we want to run one DCE before early inlining. gcc/ChangeLog: PR tree-optimization/109442 * ipa-fnsummary.cc (builtin_unreachable_bb_p): New function. (guards_builtin_unreachable): New function. (STMT_NECESSARY): New macro. (mark_stmt_necessary): New function. (mark_operand_necessary): New function. (find_necessary_statements): New function. (analyze_function_body): Use it. gcc/testsuite/ChangeLog: * gcc.dg/ipa/fnsummary-1.c: New test.