[PATCH] D28368: Give higher full-unroll boosting when the loop iteration is small.

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 14:30:52 PST 2017


hfinkel added a comment.

In https://reviews.llvm.org/D28368#637452, @danielcdh wrote:

> I don't think it is a concern.
>
> - it is a small benchmark (1.2M text size)
> - there are a lot of countable loops in the code, thus it increased the most
> - the increased size does not change performance
> - the size will not change if optForSize() is true


SGTM



================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:664
 // the unroll threshold.
+// Another side-benefit of fully unroll is to remove all branches and put all
+// instructions into a single basic block, which expands optimization windows.
----------------
fully unroll -> fully unrolling


================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:677
     // The boosting factor is RolledDynamicCost / UnrolledCost
-    return std::min(100 * Cost.RolledDynamicCost / Cost.UnrolledCost,
+    return std::min(100 * Cost.RolledDynamicCost / Cost.UnrolledCost + 400 / TripCount,
                     MaxPercentThresholdBoost);
----------------
Can you please put the magic numbers here into cl::opt flags so that it is easy to experiment with tuning them later?


https://reviews.llvm.org/D28368





More information about the llvm-commits mailing list