[llvm-commits] PATCH: Followup to r152556: Use more powerful instsimplify when actually performing the inline of a function

Chris Lattner sabre at nondot.org
Wed Mar 21 20:46:30 PDT 2012


On Mar 21, 2012, at 4:15 AM, Chandler Carruth wrote:

>  
> - I like the patch to Inliner.cpp :-)
> - The rest of the patch looks good, one typeo: "entriy".
> 
> As an effort to save some compile time, you could skip calling SimplifyInstOperands if none of the operands in FoldMappedInstruction were remapped.  If the code going into the inliner is already simplified (I think it should be due to instcombine running early?) then the non-remapped case shouldn't be simplifiable anyway.
> 
> So, Duncan had a great idea, which took me back to the first way I tried to do this -- just clone the instruction, and then run the simplify routine on the instruction. I worried about whether this would be more costly, but I actually think it's *cheaper* here. We were already going to do the remapping of every operand to the instruction, we just did it in a late pass over the instructions. That isn't terribly efficient to start with, it forces us to walk the instruction list twice rather than once. Worse, we do the exact same remapping of each operand in both places, taking two trips through the value remapper in the common case where we can't simplify the instruction away.
> 
> So I changed the code to do the operand remapping eagerly (for non-PHI nodes) and to directly simplify the cloned instructions. Much simpler now I think. =] I've attached the new patch.

This works for me, the patch looks good!  Please do some sanity checking just to make sure that compile time isn't affected adversely, but it seems reasonable.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120321/82e51f82/attachment.html>


More information about the llvm-commits mailing list