[PATCH] D150464: [FuncSpec] Improve the accuracy of the cost model.

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 20:22:58 PDT 2023


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

LGTM with nit comments. Thanks.



================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:100-103
+static Cost estimateBasicBlocks(SmallVectorImpl<BasicBlock *> &WorkList,
+                                ConstMap &KnownConstants, SCCPSolver &Solver,
+                                BlockFrequencyInfo &BFI,
+                                TargetTransformInfo &TTI) {
----------------
Let's add a comment for this since its semantics are not clear from the signature.


================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:210
+  // it is executable and has a unique predecessor.
+  SmallVector<BasicBlock *, 32> WorkList;
+  if (Solver.isBlockExecutable(Succ) &&
----------------



================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:234-236
+    if (!C) {
+      AllOperandsAreConst = false;
+      break;
----------------
Could we refactor it into this? Then we can remove `AllOperandsAreConst`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150464



More information about the llvm-commits mailing list