This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Help! PR18908 vs. PR23522 vs. Ada subtypes?
- From: Jeffrey A Law <law at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 28 Mar 2006 11:30:39 -0700
- Subject: Re: Help! PR18908 vs. PR23522 vs. Ada subtypes?
- References: <Pine.LNX.4.44.0603281038260.3942-100000@www.eyesopen.com>
- Reply-to: law at redhat dot com
On Tue, 2006-03-28 at 10:52 -0700, Roger Sayle wrote:
> It's tree-ssa's structure sharing assumptions that screw this up.
> The new low-level fold_binary interface and the fact that fold
> (should) never modify its arguments means that ideally in the example
> above you could just do.
>
> t = fold_binary (EQ/NE/GT/whatever, type, (T2)a, C);
> if (t != NULL_TREE)
> ... /* fold_binary improved things. */
>
> With this interface fold doesn't allocate any memory unless its
> discovers an beneficial transformation.
> No taxation without an improved representation! :)
>
>
> The fly in the ointment is that tree-ssa, unlike fold, destructively
> modifies trees assuming that they are never shared. One solution
> might be to copy_node on the result returned from fold_binary above.
> This will ensure that any remaining/reused pieces of (T)a and C are
> correctly unshared, with only a minor memory wastage. Indeed, in
> tree-combine, the original stmts are often known to be dead following
> a rewrite, so typically you shouldn't need the tree copy at all.
Hmmm....
It seems to me that in the case where fold_binary returns a
gimple tree that any sharing must inherently already be safe.
Even if we pass in a shared (T2)a the only usable result we get
back is always of the form
a COND C
ie, the cast must always disappear for the result to be useful.
The toplevel node is always a new node, so no sharing there. The
only things shared would be "a" and "C", which is definitely safe.
Hmm......
Jeff