From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E495C3898039; Tue, 3 Aug 2021 09:39:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E495C3898039 From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94566] conversion between std::strong_ordering and int Date: Tue, 03 Aug 2021 09:39:34 +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: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: marxin 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: --- 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 09:39:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94566 --- Comment #6 from Martin Li=C5=A1ka --- (In reply to Marc Glisse from comment #3) > I thought we had code to recognize a switch that represents a linear > function, I was hoping that it would kick in with your hoisting patch... Yep, we have the code but as mentioned the sinking needs to happen first. Otherwise, you'll see: g++ pr94566.C -O2 -fdump-tree-switchconv=3D/dev/stdout -std=3Dgnu++2a ;; Function conv2 (_Z5conv2i, funcdef_no=3D90, decl_uid=3D8463, cgraph_uid= =3D59, symbol_order=3D88) beginning to process the following SWITCH statement (pr94566.C:4) : -------= =20 switch (i_2(D)) [INV], case -1: [INV], case 0: [IN= V], case 1: [INV]> Bailing out - bad case - a non-final BB not empty -------------------------------- struct strong_ordering conv2 (int i) { struct strong_ordering D.8476; : switch (i_2(D)) [INV], case -1: [INV], case 0: [INV], case 1: [INV]> : : D.8476._M_value =3D -1; goto ; [INV] : : D.8476._M_value =3D 0; goto ; [INV] : : D.8476._M_value =3D 1; goto ; [INV] : : __builtin_unreachable (); : return D.8476; }=