This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Options that control optimization

Where is it possible to find the optimization flags which are turned on (or off) by -O1 and -O2 with ACFL 22.1.0?

Parents
  • Hi Jeani

    I'll give you two answers because it is not clear to me which one is most applicable. If you are able to share a bit more about what you are trying to achieve then I may be able to help you further.

    You can see which flags are being passed down to clang -cc1 using the -### option + a bit of scripting. There are a number of articles on this (e.g. https://gist.github.com/lolo32/fd8ce29b218ac2d93a9e) You can then use upstream documentation to decipher these. Sadly, it looks like the best source is going to be the code (see https://github.com/llvm/llvm-project/blob/release/13.x/clang/include/clang/Driver/Options.td) and even then you need to use some imagination to interpret them.

    In terms of which mid-end passes are enabled/disabled by default at each optimization level, you can find this out using the option -Xclang -fdebug-pass-manager which gives you a list of pass names in the order that they ran. You can then get a description of what these are at https://llvm.org/docs/Passes.html. I believe there is no general way to turn on/off optimization passes via clang, but I could be wrong there.

    Hopefully those were useful pointers. If you can share more about what you are trying to achieve then I may be able to help further.

Reply
  • Hi Jeani

    I'll give you two answers because it is not clear to me which one is most applicable. If you are able to share a bit more about what you are trying to achieve then I may be able to help you further.

    You can see which flags are being passed down to clang -cc1 using the -### option + a bit of scripting. There are a number of articles on this (e.g. https://gist.github.com/lolo32/fd8ce29b218ac2d93a9e) You can then use upstream documentation to decipher these. Sadly, it looks like the best source is going to be the code (see https://github.com/llvm/llvm-project/blob/release/13.x/clang/include/clang/Driver/Options.td) and even then you need to use some imagination to interpret them.

    In terms of which mid-end passes are enabled/disabled by default at each optimization level, you can find this out using the option -Xclang -fdebug-pass-manager which gives you a list of pass names in the order that they ran. You can then get a description of what these are at https://llvm.org/docs/Passes.html. I believe there is no general way to turn on/off optimization passes via clang, but I could be wrong there.

    Hopefully those were useful pointers. If you can share more about what you are trying to achieve then I may be able to help further.

Children
No data