[flang][cmake][perf-training] Optimize flang with PGO and BOLT (#198863)
This is an attempt to replicate similar fearture already available to
clang. The changes in this patch were made with an intent to reuse as
much of existing infrastructure as possible. Namely, two-stage build
arrangement, perf-helper.py script and the means for building of the
instrumented binaries have all been incorporated into this approach.
It was deliberately chosen to optimize clang along with flang as they
are mostly working together in the final toolchain.
See the `llvm/docs/AdvancedBuilds.rst` documentation for more details.
Note that the attempt to optimize flang has exceeded one of the BOLT
limitations. The size of one of the statically allocated buffers needed
to be extended in this patch.