From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 909FA3858D3C; Fri, 2 Dec 2022 15:44:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 909FA3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669995855; bh=X6NVmvpOWyXNKJSyjUNEgxWKAyM7+VLZgj4JOc8NSHc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Igp6mobd/imJvcGoNoMHS5n/aDMrHhd5lIO8k9csEJrwW841BhHUzbsZaP0uN78Y/ uM71wFxdvn5GSEuj7rCtcWjkAnl0Kx3rf9/COOuomyDQYLPHPPBXhMWqNx4TPk1W+o snsSqj7y5Z4osV8CzN4JJpQmpUfveD2E0TJa6vtY= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107767] [13 Regression] switch to table conversion happening even though using btq is better Date: Fri, 02 Dec 2022 15:44:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107767 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #12 from Jakub Jelinek --- (In reply to Richard Biener from comment #10) > Looks like a general CFG optimization if we have N forwarders to a PHI wi= th > 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. >=20 > PHI >=20 > -> >=20 > forwarder > | > PHI >=20 > CFG cleanup will then eventually elide forwarders into the added forwarde= r. Are those actually forwarder blocks though? Doesn't the GIMPLE_PREDICT statement at the start of each one of them preve= nt 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 =3D gsi_after_labels (bb); if (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) =3D=3D GIMPLE_PREDICT) gsi_remove (&gsi, true); } in pass_if_to_switch::execute before return TODO_cleanup_cfg;, but that did= n't help.=