public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/65502] pure-const should play well with clobbers.
Date: Sun, 22 Mar 2015 09:54:00 -0000	[thread overview]
Message-ID: <bug-65502-4-9qM7KNvjXe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65502-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
The following patch makes ipa-pure-const to detect these functions as
pure/const.
There are two issues
 1) I think we should preserve clobber semantic when removing a call to
pure/const
    destructor.  I wonder if we should output CLOBBER after every destructor
call
    from the gimplifier (that may be bit costy) or if we want tree-ssa-dce
    to insert the clobber when removing the statement that calls function with
    DECL_CXX_DESTRUCTOR (that is cheaper but drags in more of C++ semantics)

    Any solution to this would permit me to remove the conditional preventing
    clobbers from being ignored at compile time.
 2) The patch makes us to ICE at chromium build. The reason is that ipa-comdats
    sees symbol that should have been removed by remove_unreacable_functions
    and is not.  I suppose this is an semi-latent bug where 
    remove_unreachable_functions may need iteration in some side corners.

Fun...

Index: ipa-pure-const.c
===================================================================
--- ipa-pure-const.c    (revision 221541)
+++ ipa-pure-const.c    (working copy)
@@ -710,6 +710,16 @@ check_stmt (gimple_stmt_iterator *gsip,
   if (is_gimple_debug (stmt))
     return;

+  /* Do consider clobber as side effects before IPA, so we rather inline
+     C++ destructors and keep clobber semantics than eliminate them.
+
+     TODO: We may get smarter during early optimizations on these and let
+     functions containing only clobbers to be optimized more.  This is a
common
+     case of C++ destructors.  */
+
+  if ((ipa || cfun->after_inlining) && gimple_clobber_p (stmt))
+    return;
+
   if (dump_file)
     {
       fprintf (dump_file, "  scanning: ");


  reply	other threads:[~2015-03-21 23:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-21 10:47 [Bug ipa/65502] New: " hubicka at gcc dot gnu.org
2015-03-22  9:54 ` hubicka at gcc dot gnu.org [this message]
2015-03-23  0:16 ` [Bug ipa/65502] " hubicka at gcc dot gnu.org
2015-03-23  9:57 ` rguenth at gcc dot gnu.org
2015-03-24  6:33 ` hubicka at ucw dot cz

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-65502-4-9qM7KNvjXe@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).