[llvm] r288141 - [GVNHoist] Enable aggressive hoisting when optimizing for code-size

Gabor Ballabas via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 08:09:12 PST 2016


Hi Aditya,

My name is Gabor Ballabas, I work at the University of Szeged, Hungary.

We are running a code-size change benchmark system at www.csibe.org

I'd like to share with you - and with the community - the code-size change
results in our benchmark system after your patch landed.
We run this benchmarks after every commit in LLVM.

Your patch resulted in the following improvements in code size:

* Target: x86_64, -Oz: -0.136%
* Target: ARM, Cortex-M0, -Oz: -0.061%
* Target: ARM, Cortex-M4, -Oz: -0.211%

You can check the charts here: 
http://szeged.github.io/csibe/compiler-monitor.html

I hope you will find this feedback useful.

Best regards,
Gabor Ballabas


<www.csibe.org>


<www.csibe.org>

On 11/29/2016 03:34 PM, Aditya Kumar via llvm-commits wrote:
> Author: hiraditya
> Date: Tue Nov 29 08:34:01 2016
> New Revision: 288141
>
> URL: http://llvm.org/viewvc/llvm-project?rev=288141&view=rev
> Log:
> [GVNHoist] Enable aggressive hoisting when optimizing for code-size
>
> Enable scalar hoisting at -Oz as it is safe to hoist scalars to a place
> where they are partially needed.
>
> Differential Revision: https://reviews.llvm.org/D27111
>
> Modified:
>      llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp?rev=288141&r1=288140&r2=288141&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp Tue Nov 29 08:34:01 2016
> @@ -202,7 +202,12 @@ public:
>     GVNHoist(DominatorTree *DT, AliasAnalysis *AA, MemoryDependenceResults *MD,
>              MemorySSA *MSSA, bool OptForMinSize)
>         : DT(DT), AA(AA), MD(MD), MSSA(MSSA), OptForMinSize(OptForMinSize),
> -        HoistingGeps(OptForMinSize), HoistedCtr(0) {}
> +        HoistingGeps(OptForMinSize), HoistedCtr(0) {
> +      // Hoist as far as possible when optimizing for code-size.
> +      if (OptForMinSize)
> +        MaxNumberOfBBSInPath = -1;
> +  }
> +
>     bool run(Function &F) {
>       VN.setDomTree(DT);
>       VN.setAliasAnalysis(AA);
> @@ -500,10 +505,13 @@ private:
>     bool safeToHoistScalar(const BasicBlock *HoistBB,
>                            SmallPtrSetImpl<const BasicBlock *> &WL,
>                            int &NBBsOnAllPaths) {
> -    // Check that the hoisted expression is needed on all paths.  Enable scalar
> -    // hoisting at -Oz as it is safe to hoist scalars to a place where they are
> -    // partially needed.
> -    if (!OptForMinSize && !hoistingFromAllPaths(HoistBB, WL))
> +    // Enable scalar hoisting at -Oz as it is safe to hoist scalars to a place
> +    // where they are partially needed.
> +    if (OptForMinSize)
> +      return true;
> +
> +    // Check that the hoisted expression is needed on all paths.
> +    if (!hoistingFromAllPaths(HoistBB, WL))
>         return false;
>   
>       for (const BasicBlock *BB : WL)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

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


More information about the llvm-commits mailing list