-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to pass addition arguments to llvm pass registered by new pass manager #56137
Comments
Same question |
At the moment the only way to be able to register options and still use the new PM is to provide both the The first load will make sure the options defined in the library will be registered before command line arguments are parsed. |
OK, thanks~ |
@viroulep On clang 16 I'm getting "Bad options: -load" with this. Has the workaround changed since writing this? |
I don't think so, the foo@d366b74ba893:~/llvm/tmp/tests/Bye/build$ clang-16 -Xclang -load -Xclang ./Bye.so -fpass-plugin=./Bye.so -mllvm -wave-goodbye foo.ll -S
Bye: g
Bye: f
Bye: main While looking at the code I also realized the frontend turns foo@d366b74ba893:~/llvm/dockers/tests/Bye/build$ clang-16 -fplugin=./Bye.so -fpass-plugin=./Bye.so -mllvm -wave-goodbye foo.ll -S
Bye: g
Bye: f
Bye: main |
@viroulep Thank you! Perhaps invoking plugins this way works only on IR? If I change foo.ll into some toy foo.cpp I can no longer see "Bye: foo" |
I think it works on cpp as well: foo@cf52f006f235:~/llvm/dockers/tests/Bye/build$ cat main.cpp
int main() { return 0; }
foor@cf52f006f235:~/llvm/dockers/tests/Bye/build$ clang-16 -O1 -fplugin=./Bye.so -fpass-plugin=./Bye.so -mllvm -wave-goodbye main.cpp
Bye: main If the driver doesn't complain about an unknown option then the plugin is surely loaded and maybe it's just because you compile with |
@viroulep Thanks - you're right of course. I now think my problem is different: our plugin implements 2 passes (say "pass1" and "opass2") and according to the existing docs |
When I use
clang-13 -fpass-plugin
to load pass, and usemllvm
to provide addition argumentsThen I get error
But when I use
clang-13 -flegacy-pass-manager -Xclang -load -Xclang
to load it, everything is OKThe text was updated successfully, but these errors were encountered: