public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-99862-4-Lpv2PH5JnA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99862-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99862

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
(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] % 
> [661] % wc O1.s O3.s
>   40   86  599 O1.s
>   68  138 1047 O3.s
>  108  224 1646 total
> [662] % 
> [662] % grep foo O1.s
> [663] % grep foo O3.s
>         call    foo
> [664] % 
> [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[] = {2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2};
>   int h[60];
>   h[0] = g != c;
>   if (b)
>     while (a) {
>       int *i[1] = {&h[6]};
>     }
>   return f;
> }
> static int *j(int *p) { return 0; }
> int main () {
>   int m = 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 inline
that at -O3 while we are happy to IPA inline e() at -O1.

  parent reply	other threads:[~2021-04-09 11:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01  7:59 [Bug ipa/99862] New: " zhendong.su at inf dot ethz.ch
2021-04-01  8:01 ` [Bug ipa/99862] " zhendong.su at inf dot ethz.ch
2021-04-01  8:06 ` zhendong.su at inf dot ethz.ch
2021-04-02  0:28 ` egallager at gcc dot gnu.org
2021-04-02 17:02 ` zhendong.su at inf dot ethz.ch
2021-04-09 11:37 ` rguenth at gcc dot gnu.org
2021-04-09 11:39 ` rguenth at gcc dot gnu.org
2021-04-09 11:42 ` rguenth at gcc dot gnu.org [this message]
2021-04-09 11:53 ` rguenth at gcc dot gnu.org
2021-04-09 11:59 ` zhendong.su at inf dot ethz.ch
2021-04-10 10:12 ` egallager at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-99862-4-Lpv2PH5JnA@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).