[PATCH] D82438: [SimplifyCFG] Cost required selects

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 05:50:57 PDT 2020


lebedev.ri added a comment.

I guess it's an improvement for ARM, but the cost-modelling still looks bogus there.
It defies the point. We should calculate the single total cost of speculation,
and compare it once with the threshold, not compute parts of the cost
and compare them with the threshold each time.



================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:2107-2108
     if (!SpeculatedStoreValue &&
         ComputeSpeculationCost(I, TTI) >
             PHINodeFoldingThreshold * TargetTransformInfo::TCC_Basic)
       return false;
----------------
here too


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:2165-2170
     unsigned OrigCost = OrigCE ? ComputeSpeculationCost(OrigCE, TTI) : 0;
     unsigned ThenCost = ThenCE ? ComputeSpeculationCost(ThenCE, TTI) : 0;
     unsigned MaxCost =
         2 * PHINodeFoldingThreshold * TargetTransformInfo::TCC_Basic;
     if (OrigCost + ThenCost > MaxCost)
       return false;
----------------
and here


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82438



More information about the llvm-commits mailing list