[llvm-commits] Code hoisting in GVN

Owen Anderson resistor at mac.com
Tue Jul 31 15:33:16 PDT 2012


Nadav,

I have two high-level comments on this patch:

1) It seems like it should be possible to avoid n^2 behavior by computing a set of hoistable instructions for each successor block, and then intersecting them.
2) It seems like you should be able to re-use GVN's value numbering facilities to accelerate the identicality checks.

The way I'd envision this working would be to scan each successor block and build a map from value numbers to instructions.  Then you find value numbers that are in both maps and clone them into the predecessor.

--Owen

On Jul 30, 2012, at 4:08 PM, "Rotem, Nadav" <nadav.rotem at intel.com> wrote:

> Hi,
>  
> Please review the attached patch.
>  
> This patch adds code hoisting to GVN.  Currently, SimplifyCFG has a simple code hoisting procedure which scans both THEN and ELSE blocks of the branch and hoists instructions from both sides if they are identical.  The problem is that this linear scan is unable to find common code.  The alternative is to perform an N*M scan of the instructions in both blocks and find duplicated instructions. This patch implements the quadratic scan in GVN and has a threshold on the number of instructions to scan.  It gives a modest 1.5% speedup to SciMark2::MonteCarlo.
>  
> Thanks,
> Nadav
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
> 
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies. <hoist.diff>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120731/a8187063/attachment.html>


More information about the llvm-commits mailing list