I would like to know LLVM IR under different optimization options (e.g. -O0 -O1 …) What is the difference under different optimization options (e.g. -O0 -O1 …)?
Is it possible to use only some of the fixed instructions under the -O0 option?
I want to construct a VM to execute IR under the -O0 optimization, but I don’t want to analyze the full IR instructions.
I’m not sure I understand the question. Do you mean, is there a way to control the kind of IR instructions generated by Clang? In general, Clang will translate C/C++ code into IR instructions in a straightforward way, and the only way to affect what it produces is to give it different C/C++ input.
For example, if you give Clang a source file that does not use exceptions, you can expect that it will not emit any instructions related to exception handling (invoke, landingpad).
If you are trying to ask a different question, please give more details about your project.