https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114301
Bug ID: 114301 Summary: gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: compile-time-hog, internal-improvement Severity: enhancement Priority: P3 Component: tree-optimization Assignee: pinskia at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- It is the case that the returns twice function will always be the last statement of the BB so the check for that can be moved up to the check of the last statement part. This is a small optimization as gimple_call_flags (which calls flags_from_decl_or_type) can call special_function_p and special_function_p does string comparisons in the end. So removing as many calls to gimple_call_flags can speed up GCC slightly.