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

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 01:24:17 PDT 2022


chill added inline comments.


================
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;
----------------
ChuanqiXu wrote:
> 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.
Indeed, this change is just a refactoring, I moved it towards the beginning of `isArgumentInteresting` since it's a more logical place for this test to be.

I don't mind not applying this change  here in this patch, I have another one coming that's just refactoring/optimisaiton(?) and I can include it there.


================
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();
----------------
ChuanqiXu wrote:
> nit:
Ack.


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

https://reviews.llvm.org/D135893



More information about the llvm-commits mailing list