[llvm-commits] [PATCH] Phi node folding improvements

Peter Collingbourne peter at pcc.me.uk
Wed Oct 13 19:23:45 PDT 2010


Hi Chris,

On Sun, Sep 05, 2010 at 01:16:25PM -0700, Chris Lattner wrote:
> 
> On Jul 30, 2010, at 1:15 PM, Peter Collingbourne wrote:
> 
> > Hi,
> > 
> > The attached patches improve the flexibility of the phi node folding
> > mechanism by assigning a cost to each non-trapping instruction and
> > allowing the user to specify a maximum cost threshold.  By increasing
> > the threshold the user can apply phi node folding to more complex
> > expressions.
> > 
> > I developed this patch as part of my work with the Klee symbolic
> > virtual machine, which can handle symbolic expressions containing
> > selects more efficiently than branches conditional on symbolic
> > expressions.  However I imagine it could also provide an advantage on
> > architectures with relatively expensive branch operations (I haven't
> > done any experiments to determine if this is the case though).
> > 
> > The patches should not contain any changes to default functionality,
> > except for adding more instructions to the list of "cheap" (folded
> > by default) instructions.
> 
> Hi Peter,
> 
> Sorry for the delay on this.  The first patch certainly looks ok, but we need testcases for each of these changes.

I've now revised the patch series.  The main difference versus the
previous series is that the supplied cost threshold applies to both
predecessors independently of each other rather than taking the
combined cost (which is why the default is now 1).  The threshold
now roughly represents the maximum potential amount of 'wasted' work,
which I imagine could be a factor that would be weighed against the
cost of branching on a specific architecture.

I have also added test cases, which include test cases to ensure
that the changes do not in fact change default functionality.

Thanks,
-- 
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-Trunc-ZExt-and-SExt-to-the-list-of-cheap-instruc.patch
Type: text/x-diff
Size: 2240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101014/4ea9ed8a/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-CostRemaining-parameter-to-DominatesMergePoint.patch
Type: text/x-diff
Size: 5484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101014/4ea9ed8a/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Expose-phi-node-folding-cost-threshold-as-command-li.patch
Type: text/x-diff
Size: 3140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101014/4ea9ed8a/attachment-0002.patch>


More information about the llvm-commits mailing list