[PATCH] D86346: [SimplifyCFG] Accumulate cost against budget

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 06:34:48 PDT 2020


samparker added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:2051
   int BudgetRemaining =
     PHINodeFoldingThreshold * TargetTransformInfo::TCC_Basic;
   for (PHINode &PN : EndBB->phis()) {
----------------
lebedev.ri wrote:
> Please add a new `cl::opt` for that.
> I believe, the threshold should be the branch misprediction cost,
> i.e. if it takes less cost (latency) to execute the branch
> then to wrongly predict that it won't be executed,
> but then rewind and execute it anyways, we should just execute it.
> 
> So i'd go with `20`.
Most of the cost modelling framework actually tries to assume that branches are always predicated though, and I don't understand why making arbitrary decisions about machine details would be a good idea here. Plus, it's also completely irrelevant to code size...  It would seem to be better to query the latency / size of the branch, but I highly doubt that would produce results that anyone would want...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86346/new/

https://reviews.llvm.org/D86346



More information about the llvm-commits mailing list