[PATCH] D135893: [FuncSpec] Fix specialisation based on literals

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 19:37:21 PDT 2022


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

Neat! I really enjoy reading your work. Thanks!



================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:712-715
-    // SCCP solver does not record an argument that will be constructed on
-    // stack.
-    if (A->hasByValAttr() && !F->onlyReadsMemory())
-      return;
----------------
This change looks not related to this diff? Although it is bad that the tests still pass after deleting this. But I prefer to remain this if this is not intended.


================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:762-775
+      Constant *C = nullptr;
+      if (isa<Constant>(V))
+        C = cast<Constant>(V);
+      else {
+        const ValueLatticeElement &LV = Solver.getLatticeValueFor(V);
+        if (LV.isConstant())
+          C = LV.getConstant();
----------------
nit:


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

https://reviews.llvm.org/D135893



More information about the llvm-commits mailing list