public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [tree-ssa] vdefs vs DCE
@ 2003-05-22 14:55 law
  2003-05-22 18:12 ` Diego Novillo
  0 siblings, 1 reply; 3+ messages in thread
From: law @ 2003-05-22 14:55 UTC (permalink / raw)
  To: dnovillo, amacleod; +Cc: gcc


So can someone educate me as to why DCE has to look at VDEFs when 
trying to determine if a statement is useful?

The reason I'm asking is doing so causes DCE to keep around a fair number
of stores which are trivially shown to be unnecessary.

Let's consider gimplification of this code

   foo ("fu", "bar", "com")

We'll gimplify that into something like

   T1 = "fu"
   T2 = "bar"
   T3 = "com"
   foo (T1, T2, T3)

[ Frankly that seems rather silly as well -- but I'll postpone that argument
  for another day. ]


Now since T1, T2 and T3 are used as arguments, we consider the memory
they point to as modified by the call itself and we consider *T1, *T2 and *T3
as aliasing global memory.

That in turn causes us to hang a bunch of VDEFs on the assignments to T1, T2
and T3.

Anyway, we go into SSA form and we have:

   T1 = "fu"
   T2 = "bar"
   T3 = "com"
   foo ("fu", "bar", "com")

[ See why I said the gimplification was rather silly? :-) ]

T1, T2 and T3 are never used again.  But because we've got those annoying
VDEFs we consider each of those statements are useful and thus they are not
removed.

So you might legitimately ask is this important.  Consider that this is
going to happen anytime we pass strings as arguments to functions!  Or
that every call to abort within gcc itself will result in two of these
stores that we can't eliminate due to their VDEFS (look at how abort
expands into fancy_abort)...


Jeff







^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-05-22 18:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-22 14:55 [tree-ssa] vdefs vs DCE law
2003-05-22 18:12 ` Diego Novillo
2003-05-22 18:22   ` law

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).