[PATCH] D26989: Use continuous boosting factor for complete unroll.

Dehao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 16:10:05 PST 2016


danielcdh added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:745-746
+                : Cost->RolledDynamicCost * 100 / Cost->UnrolledCost;
+        unsigned ThresholdBoost = std::min(Benefit * Benefit / 10000,
+                                           UP.PercentMaxThresholdBoost / 100);
+        if (Cost->UnrolledCost < UP.Threshold * ThresholdBoost) {
----------------
mzolotukhin wrote:
> 1) Why do we use `Benefit*Benefit` here?
> 2) The result is `unsigned`, which means that the values we can get here are very limited (1,2,3, or 4 with `PercentMaxThresholdBoost` = 400). I'd suggest computing the upper bound for the cost, not the benefit to work around it.
> 
> Also, this code needs some comments, it's not obvious what we're doing here.
Updated the code and comments, hopefully makes it clear.


https://reviews.llvm.org/D26989





More information about the llvm-commits mailing list