From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CC76F398B42D; Fri, 9 Apr 2021 11:42:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC76F398B42D From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/99862] [meta-issue] various missed optimizations for dead code elimination Date: Fri, 09 Apr 2021 11:42:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: unknown X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: Fri, 09 Apr 2021 11:42:34 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99862 --- Comment #7 from Richard Biener --- (In reply to Zhendong Su from comment #2) > [659] % gcctk -O1 -S -o O1.s small.c > [660] % gcctk -O3 -S -o O3.s small.c > [661] %=20 > [661] % wc O1.s O3.s > 40 86 599 O1.s > 68 138 1047 O3.s > 108 224 1646 total > [662] %=20 > [662] % grep foo O1.s > [663] % grep foo O3.s > call foo > [664] %=20 > [664] % cat small.c > extern void foo(void); > int a, b, *c; > static void d(int f) { > if (f) > foo(); > } > static int e(int f) { > int g[] =3D {2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}; > int h[60]; > h[0] =3D g !=3D c; > if (b) > while (a) { > int *i[1] =3D {&h[6]}; > } > return f; > } > static int *j(int *p) { return 0; } > int main () { > int m =3D e(0); > d(m); > int l[8]; > if (j(l)) > while (1) > ; > return 0; > } This is a case similar to PR99991, we create a IPA CP clone and fail to inl= ine that at -O3 while we are happy to IPA inline e() at -O1.=