From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5C9D4385E451; Wed, 20 Dec 2023 19:07:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C9D4385E451 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703099267; bh=kJfKIhxYhBsIX1Fr7UmjEiSNfFPiIV2X/uc/pUrSMtM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vJLaCH8i2ieS4toUBs8pGXxicBtbJfyYKVWx5Kr5pCgY1/aX1rfkZ9sm+jTFCBy/y yHiAHKRrAc1FFyNdQAEuf3D2FTOUus7WaRPBcRaZhNuhnOA5CpE8lLEuerNiKfzfJ9 5AMHtBVO6jIHeJzfZnjJaQOH1GZ9hXCXOk7qhqtI= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/111702] [14 Regression] ICE: in insert_regs, at cse.cc:1114 with -O2 -fstack-protector-all -frounding-math Date: Wed, 20 Dec 2023 19:07:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.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=3D111702 --- Comment #4 from GCC Commits --- The trunk branch has been updated by Richard Sandiford : https://gcc.gnu.org/g:08ab2293dcce442e139b163ba22f65a32e7ebd6c commit r14-6757-g08ab2293dcce442e139b163ba22f65a32e7ebd6c Author: Richard Sandiford Date: Wed Dec 20 19:07:35 2023 +0000 cse: Fix handling of fake vec_select sets [PR111702] If cse sees: (set (reg R) (const_vector [A B ...])) it creates fake sets of the form: (set R[0] A) (set R[1] B) ... (with R[n] replaced by appropriate rtl) and then adds them to the tables in the same way as for normal sets. This allows a sequence like: (set (reg R2) A) ...(reg R2)... to try to use R[0] instead of (reg R2). But the pass was taking the analogy too far, and was trying to simplify these fake sets based on costs. That is, if there was an earlier: (set (reg T) A) the pass would go to considerable effort trying to work out whether: (set R[0] A) or: (set R[0] (reg T)) was more profitable. This included running validate*_change on the set= s, which has no meaning given that the sets are not part of the insn. In this example, the equivalence A =3D=3D T is already known, and the purpose of the fake sets is to add A =3D=3D T =3D=3D R[0]. We can do t= hat just as easily (or, as the PR shows, more easily) if we keep the original form of the fake set, with A instead of T. The problem in the PR occurred if we had: (1) something that establishes an equivalence between a vector V1 of M-bit scalar integers and a hard register H (2) something that establishes an equivalence between a vector V2 of N-bit scalar integers, where Nnext_same_value) if (rtx_equal_p (elt->exp, x)) return elt; to insert_with_costs, or by making cse_insn check whether previous sets have recorded the same equivalence. The latter seems more appealing from a compile-time perspective. But in this case, doing that would be adding yet more spurious work to the handling of fake sets. The handling of fake sets therefore seems like the more fundamental bug. While there, the patch also makes sure that we don't apply REG_EQUAL notes to these fake sets. They only describe the "real" (first) set. gcc/ PR rtl-optimization/111702 * cse.cc (set::mode): Move earlier. (set::src_in_memory, set::src_volatile): Convert to bitfields. (set::is_fake_set): New member variable. (add_to_set): Add an is_fake_set parameter. (find_sets_in_insn): Update calls accordingly. (cse_insn): Do not apply REG_EQUAL notes to fake sets. Do not try to optimize them either, or validate changes to them. gcc/testsuite/ PR rtl-optimization/111702 * gcc.dg/rtl/aarch64/pr111702.c: New test.=