Nothing print out by opt -load

I’m trying to use the optimization by using shared object.

the command I try is: opt input.ll

But there is nothing printing out.

The output maybe the functions name in the input.ll Like opt -passes=helloworld input.ll

I enter the command llvm-config --shared-mode to check the status, and it print out shared.

How can I fix it?

Hey @shane87123 !

opt input.ll

This command does not specify which pass to run :slight_smile:



Sorry for asking such a stupid question.

A can answer myself after trying the opt tool in these days.

In my experiments, It’s not necessary to use opt to plugin the shared-object file only using opt -passes=pass.

If your LLVM compilers build by “share-library”, it used the shared-object files.

In this question, the way to use the can just be opt -passes=helloworld input.ll.

To check this feature, we can build two different files with different things to do, and just replace each other in llvm-project/build/lib/ to switch the shared-object files.

For example: Now I have two helloworld shared-object files - and

$ cp ~/llvm-project/build/lib/
$ opt -passes=helloworld input.ll
## Do the things what does ##

$ cp ~/llvm-project/build/lib/
$ opt -passes=helloworld input.ll
## Do the things what does ##

No question is stupid. Just ask! Maybe others have the same question as yours.