[PATCH] D93838: [SCCP] Add Function Specialization pass

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 01:47:48 PDT 2021


SjoerdMeijer added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:904
+      // FIXME: Only one argument per function.
+      return true;
+    }
----------------
.... here!

It stops after specialising one argument. This is very arbitrary and probably what we want to fix in the first version.
This requires a bit of a reshuffle, which is what I am addressing now.


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:2392
+      SmallVector<Constant *, 4> Constants;
+      if (!isArgumentInteresting(&A, Constants, IsPartial))
+        continue;
----------------
ChuanqiXu wrote:
> If there is a callsite look like this:
> ```
> foo(1, 2, 3, 4);
> ```
> Would the compiler transform it into?
> ```
> foo_1(2, 3, 4);
> ```
> then
> ```
> foo_1_2(3, 4)
> ```
> then
> ```
> foo_1_2_3(4)
> ```
> finally
> ```
> foo_1_2_3_4()
> ```
> The process looks a little bit weird.
> 
Currently, it will only specialises this into:

  foo_1(2, 3, 4);

because there is a limitation that it specialises 1 argument, see my next comment below....


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

https://reviews.llvm.org/D93838



More information about the llvm-commits mailing list