public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	gcc-patches@gcc.gnu.org,	Jan Hubicka <hubicka@ucw.cz>
Subject: Re: [PR libmudflap/53359] don't register symbols not emitted
Date: Wed, 16 Jan 2013 10:24:00 -0000	[thread overview]
Message-ID: <20130116102428.GD5949@kam.mff.cuni.cz> (raw)
In-Reply-To: <orhamh5vcv.fsf@livre.localdomain>

> No, the bug is that we're registering something because at an earlier
> point (when we emitted checks) there were references to it.  The
> references were all optimized away, we correctly decided (elsewhere) the
> object was not referenced, and we removed it from the symbol table, but
> mudflap still wants to register it because it pays no attention to that
> decision.
> 
> This is the reason why I believe the patch I proposed initially is the
> correct fix.  Now, can you please tell me why you believe this diagnosis
> is incorrect, or why the fix for the diagnosed problem is incorrect, to
> the point of proposing alternate (faulty) approaches?
> 
> > I suppose instead of asking for TREE_ASM_WRITTEN you may want to look
> > at DECL_RTL (which should be set for all referenced decls, whether
> > external or not).
> 
> I'm pretty sure the optimized-away objects that we do NOT want to
> register had DECL_RTL set, but I'm not exactly excited about double
> checking it without at least a hint of an explanation on what seems to
> be wrong with the proposed patch.

Well, from symtab point of view, the early mudflap pass (that is
collecting vars it wants to later reffer to) should
 - either build the references to them early and produce the constructor referencing
   them early.  Then symtab has full information about what is going to be output
   and everything works well.  This is what I slowly did to many parts of compiler,
   like C++, EH or OBJC interfaces that used to be output late.
 - of if there is good reason to delay this till end of the compilation it should
    1) force them to be output when seeing early so they are not optimized away
    2) check if they are optimized away or not.

2) has the obvious advantage that unused vars are not going to be output just
for sake of checking code.  For 2) the symtab_get_node test seems resonable to
me.  It is what dwarf2out does, too.  We keep nodes for external vars that are
refereed but we remove all optimized out nodes.

At this point TREE_ASM_WRITTEN should have pretty much same info with two differences
 1) for const_decls in constant pool varpool is still not representing things accurately
 2) I would like to eventually get rid of TREE_ASM_WRITTEN in favor of test in symtab
(in 4.9 I will unify the var/function flags in symtab to make this easier and I
will add noes for labels since these are also needed for acurate partitioning.
I would like to also eventually get rid of on-the-side constant pool but as
explained in the HP PR it is not trivial, given how constant pool is tied to
rtl codegen and machine reorg for some targets).
So I am not really keen for new uses of this flag appearing.

I believe CONST_DECLs are not a concern here.  Otherwise I guess TREE_ASM_WRITTEN
is good hack for 4.8 modulo the fact htat some FEs still trick with it.

Honza

  reply	other threads:[~2013-01-16 10:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21  5:34 Alexandre Oliva
2012-12-21  9:51 ` Richard Biener
2012-12-21  9:55   ` Jakub Jelinek
2012-12-21 10:42     ` Jan Hubicka
2012-12-30  0:23   ` Alexandre Oliva
2013-01-02 14:53     ` Richard Biener
2013-01-06 19:48       ` Alexandre Oliva
2013-01-07  9:28         ` Richard Biener
2013-01-16  9:29           ` Alexandre Oliva
2013-01-16 10:24             ` Jan Hubicka [this message]
2013-01-16 13:17               ` Alexandre Oliva
2013-01-16 13:48                 ` Richard Biener
2013-01-18 11:44               ` Alexandre Oliva

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=20130116102428.GD5949@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=aoliva@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /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).