[llvm] r269266 - [Layout] Add a new option (NFC)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 05:32:36 PDT 2016


On Wed, May 11, 2016 at 7:04 PM, Xinliang David Li via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: davidxl
> Date: Wed May 11 21:04:41 2016
> New Revision: 269266
>
> URL: http://llvm.org/viewvc/llvm-project?rev=269266&view=rev
> Log:
> [Layout] Add a new option (NFC)
>
> Currently cost based loop rotation algo can only be turned on with
> two conditions: the function has real profile data, and
> -precise-rotation-cost
> flag is turned on. This is not convenient for developers to experiment
> when profile is not available. Add a new option to force the new
> rotation algorithm -force-precise-rotation-cost
>
>
>
> Modified:
>     llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
>
> Modified: llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp?rev=269266&r1=269265&r2=269266&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp (original)
> +++ llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp Wed May 11 21:04:41
> 2016
> @@ -99,6 +99,11 @@ static cl::opt<bool>
>                          cl::desc("Model the cost of loop rotation more "
>                                   "precisely by using profile data."),
>                          cl::init(false), cl::Hidden);
> +static cl::opt<bool>
> +    ForcePreciseRotationCost("force-precise-rotation-cost",
> +                             cl::desc("Model the cost of loop rotation
> more "
> +                                      "precisely by using profile data."),
>

This is the same description as PreciseRotationCost. Is the idea that there
may be some profile data just not in the entry block? When would that
happen in practice? If just for experimentation, would another approach be
to add a profile count to the entry block or is that not feasible?
Otherwise, maybe change this to something like "Force the modeling of loop
rotating costs using possibly incomplete profile data"?



> +                             cl::init(false), cl::Hidden);
>
>  static cl::opt<unsigned> MisfetchCost(
>      "misfetch-cost",
> @@ -1126,7 +1131,8 @@ void MachineBlockPlacement::buildLoopCha
>    // this loop by modeling costs more precisely which requires the
> profile data
>    // for better layout.
>    bool RotateLoopWithProfile =
> -      PreciseRotationCost && F.getFunction()->getEntryCount();
> +      ForcePreciseRotationCost ||
> +      (PreciseRotationCost && F.getFunction()->getEntryCount());
>
>    // First check to see if there is an obviously preferable top block for
> the
>    // loop. This will default to the header, but may end up as one of the
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>



-- 
Teresa Johnson |  Software Engineer |  tejohnson at google.com |  408-460-2413
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160512/dd5306a7/attachment.html>


More information about the llvm-commits mailing list