From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C790B3840C0A; Mon, 22 Jun 2020 13:05:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C790B3840C0A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592831100; bh=jpjFVzxDDPTDYt7Xgz1lMFDe0VNxX08I9e/Vs4ex7gc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PIq76C16ev7ZTECbn7GggSz7KnnRok3oj63egAR+PCMdpOfUZE3ddjzhp2hn7ZBeo UTCTMAGJ6pYWam5IxipB520NLPOfHCOIIV5M0/xZCHl5R11HWmVcpv4/5TC8zjfIpD OsFsKt3u+Xcgz8igrYdA8ADI+hGmnY29DoyJa2zo= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/95798] [10/11 Regression] Initialization code --- suboptimal Date: Mon, 22 Jun 2020 13:05:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 9.3.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: 10.2 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: Mon, 22 Jun 2020 13:05:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95798 --- Comment #4 from Jakub Jelinek --- Partially related, using the following -O2 -fno-ipa-icf: void foo (int x, int *p) { p[x + 1] =3D 1; } void bar (int x, int *p) { p[x + 1UL] =3D 1; } void baz (int x, int *p) { unsigned long l =3D x; l++; p[l] =3D 1; } void qux (int x, int *p) { unsigned long l =3D x + 1; p[l] =3D 1; } we get the same 3 insn functions for the first 3 cases and 4 insn for the l= ast one. I'm surprised that we treat foo and qux differently, as x + 1 has undefined overflow, so (unsigned long) (x + 1) can be implemented with x + = 1UL and when used in address arithmetics it should be beneficial like that (so shall e.g. expansion optimize it, or ivopts, or isel)?=