This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fold_build


Hello,

> > I thought I somewhere saw either implementation or at least proposal for
> > fold_buildN functions (that would be functionally equivalent to
> > fold (buildN (...)), but not requiring building of the tree node),
> > but now I cannot find it anywhere.
> > 
> > Does this really exist?  If not, does someone work on it?
> 
> Yes, I've done that once.  The effect in compile time was
> unmeasurable.

this is hardly suprising, given the definition of fold_buildN as

+tree
+fold_build2 (enum tree_code code, tree type, tree arg0, tree arg1)
+{
+  tree built_tree = build2 (code, type, arg0, arg1);
+  tree folded_tree = fold (built_tree);
+  total_fold_build++;
+  if (built_tree != folded_tree)
+    built_tree_not_returned++;
+  return folded_tree;
+}

We could expect some speedups (or at the very least, memory savings) when
fold_build2 calls directly fold with arg0 and arg1 properly set up,
without creating the new tree node.

> I am attached my patch for you, but please don't expect it to be fully
> polished.

Could you please polish it and submit (if you lack time, I may do it
myself)? By itself this is a nice cleanup, and a necessary step for the
further work described above -- it just does not make sense that someone
eles should eventually spend time again with mechanical rewriting of
fold (build (...)).

Zdenek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]