Is it possible to use LLVM Pass module in Solang?
Hi there!
I'm curious about whether Solang supports loading LLVM Pass module to perform some preprocessing on the generated LLVM-IR.
For instance, we can use LLVM Pass module in clang like this:
clang -Xclang -load -Xclang ../build/PlacementPass/libLLVMPassname.so demo.c -o demo
Can Solang do the same thing?
As solang uses llvm, there is no reason why it should not support it. Right now it does not have the command line options and the hooks to make this happen though.
For what reason are you interested in this? Is there specific pass you have in mind?
There are already smart contract vulnerability detection and automatic repair solutions. I'm thinking about that if we can use LLVM to compile smart contract source code, we can add these features to LLVM Pass module, which can be used in the process of compiling.
Some general optimization schemes on Solidity can also be applied to LLVM Pass, by the way.
Ok, interesting. Do you have a specific pass in mind?
I found a pretty interesting paper which provides a vulnerability detection method based on a series of well-defined dependency rules, and the corresponding patch scheme.
Therefore, I will try to optimize and port this set of programs to LLVM Pass though it's just a idea in my mind for now.
ok. The reason I ask for a specific pass is that a) there is a something to test and develop against and b) there is a specific benefit today.
Got it. Thanks for your reply!
Let me know if you make any progress writing the pass, I'll will look at adding this to solang when needed.