I want to run the ipsccp built-in optimization pass with function specialization enabled. I can see the option when I run opt --print-passes. The problem is when I run the following:
clang -O2 ../../test/HelloWorld.c -emit-llvm -c -o ../../test/helloworld.bc
opt -passes='ipsccp(func-spec)' ../../test/helloworld.bc -o sccp.bc
I get an error:
opt: invalid use of 'ipsccp' pass as module pipeline
I am not sure how to fix this error.
How do I run the ipsccp pass?
The pass parameters are indicated using
<> and not
-passes='ipsccp<func-spec>' should probably work better.
Parenthesis is used for pass managers, as in this example
module(...) models that
msan should be run in a module pass manager pipeline.
Btw, if you have the source tree, then a
git grep passes llvm/test would give you lots of examples
Another way to find an example on how the pipeline might look is to, for example, run
opt -S -O3 -print-pipeline-passes < /dev/null. That will show the pipeline corresponding to O3.
Thank you! This was super helpful. This is a random follow-up question, but I have run -O3 and the ipsccp with specialization turned on and some other arguments to try to get more aggressive function specialization in programs like nginx, sqlite3, sed, etc. sqlite3 is one of the programs that it was tested on during its introduction in 2021 according to the slides, and they saw over 100 specializations when it was forced on. I have not seen a single function specialized in any of those programs. I confirmed by reading the dbg messages printed after the pass runs (the destructor functions gives the total number specialized then cleans up and the pass finishes).