From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E82A33858C53; Fri, 2 Dec 2022 15:31:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E82A33858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669995067; bh=Anu3i0fhJL+MH7mbtj2IQg1oW5IkbV2o7yfDB73O5Aw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SpZ5uIc+rHhn41s+pE0FSuG7ZA5wfkPcCEiiXI4s4yL5FhsKp08Md9dw5TKr1872q xAi8wshgbfBDQVwzmhYj6J+TMS90IROPh4xDvDOzZhzeR1xncUhIVTF8Dbor1sTD7M SI8PuRHOSAOyYc6sCyJ+eZi5T/nUy/sMs8SnkRZk= 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:31:07 +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: 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 --- Comment #11 from Jakub Jelinek --- (In reply to Martin Li=C5=A1ka from comment #7) > However, the CFG is not collapsed and thus it fails due to: >=20 > bool > bit_test_cluster::is_beneficial (unsigned count, unsigned uniq) > { > return (((uniq =3D=3D 1 && count >=3D 3) > || (uniq =3D=3D 2 && count >=3D 5) > || (uniq =3D=3D 3 && count >=3D 6))); > } >=20 > as count =3D=3D 7. and so tree-switch-conversion happens. So one can miti= gate > that with: > 1) use switch statement instead of if series > 2) reduce -param=3Dswitch-conversion-max-branch-ratio=3D that will not cr= eate so > big CSWTCH array > 3) disable tree-switch-conversion pass But that just means that either iftoswitch should happen earlier or switchc= onv later so that some other pass would remove the redundancies, or iftoswitch should perform them when it optimizes something, or switchconv should not rely on = the collapsing being done already and do it itself. In the #c9 testcase, it is cleanup_tree_cfg (TODO_update_ssa) during ccp1 p= ass that optimizes it. But cleanup_tree_cfg (0) during iftoswitch for firewall2 doesn't do that for some reason.=