From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5CA983858C83; Wed, 11 Jan 2023 14:46:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5CA983858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673448415; bh=3CcpdqBdDxFsdL13c9B5EWXkh0qGXfaxPUmEj6bltu8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aqeyDFQXBlY9lEqK7wS0YyDTZlDdAVDN6Elzg8wZ/DIZBbJUa7KRSE4+8FHACvoVY C2z29imDzJ0zKR+uaJsYfs6c/XNjKjCiIE8+PQZgHzAvFh1sJUqbSVsTmVvzANvbD+ 5jX672OIKKwMk/APMfkUWFCfctdkKS7QF842svng= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108355] [13 Regression] Dead Code Elimination Regression at -O2 since r13-2772-g9baee6181b4e42 Date: Wed, 11 Jan 2023 14:46:55 +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: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth 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=3D108355 --- Comment #2 from Richard Biener --- Basically get_ref_base_and_extent trusts TYPE_SIZE of the array operand of = an ARRAY_REF (it would also use range info on an SSA name index, but we'd expe= ct a singleton to be propagated there already). In principle that would be a general "folding" trick we can apply to more consistently handle this situation across passes. gimplification might be the "nicest" place to handle this, OTOH inlining / CCP might turn VLAs into [1] as well.=