[PATCH] D157123: [FuncSpec] Rework the discardment logic for unprofitable specializations.

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 01:16:37 PDT 2023


ChuanqiXu accepted this revision.
ChuanqiXu added a comment.
This revision is now accepted and ready to land.

LGTM with moving the comment.



================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:844-845
+      if (!ForceSpecialization &&
+         (VisitorBonus.CodeSize <= SpecCost / CodeSizeRatio ||
+          VisitorBonus.Latency / BonusRatio < VisitorBonus.CodeSize) &&
+          InliningBonus / BonusRatio < SpecCost)
----------------
labrinea wrote:
> ChuanqiXu wrote:
> > I am wondering if the condition `||` may be too strict. My rough feeling is: it is good enough to perform specialization if we can see one of the benefits.
> Without the latency condition CTMark triggers too much. The two conditions seem to work quite well in conjunction, CTMark gets less specializations than before, which is good for compile times, but we still specialize the interesting cases (mcf, exchange).
The result from benchmark is overwhelming : )


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157123



More information about the llvm-commits mailing list