Thin and full LTO modes use different pre-link pipelines compared to regular compilation. This patch adds support for calling those pipelines.
This patch closely mimics clang implementation with the exception that I changed the codegen option name from PrepareForLTO to PrepareForFullLTO to be more precise.
With this patch:
- Compilation for full LTO should be as we expect (except possibly missing optimizations enabled by module summaries which we do not produce yet)
- thinLTO uses the correct prelink pipeline but will use the postlink backend for fullLTO due to missing metadata and summary in the llvm module. I have added a warning regarding this: flang-new: warning: the option '-flto=thin' is a work in progress