public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Richard Biener <rguenther@suse.de>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	gcc@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: Detect EAF flags in ipa-modref
Date: Mon, 16 Nov 2020 13:44:36 +0100	[thread overview]
Message-ID: <20201116124436.GB72497@kam.mff.cuni.cz> (raw)
In-Reply-To: <nycvar.YFH.7.76.2011161333410.10073@p653.nepu.fhfr.qr>

> > 
> > Richi, I think we can add "safe" parameter to gimple_call_arg_flags and
> > bypass this logic when we use it for warnings only (having body that
> > does not use the value is quite strong hint that it is unused by the
> > function).
> 
> Eh, please not.

OK, I do not care that much as long as we do not have false positives
everywhere :)

Hadling EAF_UNUSED and CONST functions is necessary so we do not get
false positive caused by us optimizing code out.  In this case of not
trusing EAF_UNUSED flag we will not optimize, so I do not really care.

Martin, we collected very many warnings when building with
configure --with-build-config=bootstrap-lto.mk
This patch fixes some of them, but there are many others, can you take a
look?

For the testcase in PR I think it is enough to use default_is_empty_type
to disable the warning, but it is not clear to me why the code uses
default_is_empty_record at first place.
> 
> > 
> > I played with bit more testcases and found that we also want to disable
> > warning for const functions and sometimes EAF_UNUSED flag is dropped
> > becaue of clobber that is not necessary to do.  If function only clobber
> > the target it can be considered unused past inlining.
> > 
> > I am testing this improved patch and plan to commit if there are no
> > complains, but still we need to handle binds_to_current_def.
> > 
> > On the other direction, Martin, I think we may also warn for args
> > that are !EAF_UNUSED and !EAF_NOCLOBBER.  This will catch some cases
> > where user did not add "const" specifier to the declaration but
> > parameter is detected to be readonly.
> > 
> > I also noticed that we do not detect EAF_UNUSED for fully unused
> > parameters (with no SSA names associated with them).  I will fix that
> > incrementally.
> 
> Make sure to not apply it based on that reason to aggregates ;)

Sure, we already have detection of unused params in ipa-prop, so I guess
we want is_giple_ref (parm) && !default_def to imply EAF_UNUSED.

Honza

  reply	other threads:[~2020-11-16 12:44 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-08 12:47 Definition of EAF_NOESCAPE and fnspec strings Jan Hubicka
2020-11-09  7:31 ` Richard Biener
2020-11-09 10:29   ` Jan Hubicka
2020-11-09 12:38     ` Richard Biener
2020-11-09 13:16       ` Detect EAF flags in ipa-modref Jan Hubicka
2020-11-09 23:14         ` Jan Hubicka
2020-11-10  9:17           ` Jan Hubicka
2020-11-10 10:25           ` Jan Hubicka
2020-11-10 10:55             ` Jan Hubicka
2020-11-10 11:04           ` Richard Biener
2020-11-10 12:54             ` Jan Hubicka
2020-11-10 14:31               ` Jan Hubicka
2020-11-13  8:06                 ` Richard Biener
2020-11-15 13:25                   ` H.J. Lu
2020-11-15 14:13                     ` Jan Hubicka
2020-11-15 10:41                 ` Andreas Schwab
2020-11-15 11:12                   ` Jan Hubicka
2020-11-15 11:25                     ` Rainer Orth
2020-11-15 12:33                       ` Jan Hubicka
2020-11-15 12:43                         ` Rainer Orth
2020-11-15 13:03                           ` Jan Hubicka
2020-11-15 16:03                             ` Rainer Orth
2020-11-15 16:15                             ` Andreas Schwab
2020-11-15 18:07                               ` Jan Hubicka
2020-11-16  7:48                                 ` Richard Biener
2020-11-16  9:26                                 ` Andreas Schwab
2020-11-16 10:59                                   ` Jan Hubicka
2020-11-16 12:36                                     ` Richard Biener
2020-11-16 12:44                                       ` Jan Hubicka [this message]
2020-11-16 19:33                                         ` Martin Liška
2020-11-16 19:46                                           ` Jan Hubicka
2020-11-11 10:09               ` Richard Biener

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=20201116124436.GB72497@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=rguenther@suse.de \
    --cc=schwab@linux-m68k.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).