[Mesa-dev] [PATCH 1/5] glsl/cse: Use ir_rvalue_enter_visitor instead of ir_rvalue_visitor

Kenneth Graunke kenneth at whitecape.org
Thu Apr 9 14:40:09 PDT 2015


On Wednesday, April 08, 2015 04:38:27 PM Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> ir_rvalue_visitor visits each rvalue on exit.  When visiting a large
> expression, the leaf expressions will be visited and eliminated first.
> Once one leaf expression was replaced, it would no longer match a
> potentially much larger tree.  This means that code like:
> 
>     x = a + (b * c);
>     y = -(a + (b * c));
> 
> would effectively be replaced by
> 
>     tmp = b * c;
>     x = a + tmp;
>     y = -(a + tmp);
> 
> As a result both opportunities for generating a MAD would be lost, and
> we would generate worse code.
> 
> Using ir_rvalue_enter_visitor means that larger expression trees will be
> checked first, and we have the potential to eliminate much larger
> expressions.
> 
> I believe that opt_cse.cpp predates the existence of
> ir_rvalue_enter_visitor.

I'm still concerned about this patch.  It means that for every node in
the expression tree, we have to traverse its subtree.

It seems like that could increase the CPU cost of this pass
considerably.  I suppose many nodes end up comparing not-equal fairly
quickly...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150409/7c34a19c/attachment.sig>


More information about the mesa-dev mailing list