Prior to this change, using -fdiagnostics-show-hotness with a sampling
profile specified via -fprofile-sample-use= would result in the Clang
frontend emitting a warning: "argument '-fdiagnostics-show-hotness' requires
profile-guided optimization information". Of course, a sampling profile
*is* profile-guided optimization information, so the warning is misleading.
Furthermore, despite the warning, hotness was displayed based on the data in
the sampling profile.
Prevent the warning from being emitted when a sampling profile is used, and
add a test that verifies this.
Ideally, I'd like for this test to be identical to the ones that use -verify above, save for using -fprofile-sample-use. However I couldn't figure out how to write optimization-remark-with-hotness-sample.proftext such that it would produce hotness info for each of the functions. I'm able to confirm, using real sampling from another program of mine, that remarks using AutoFDO data do indeed show hotness, but this test does not verify this in its current state.
Any advice here? I wrote optimization-remark-with-hotness-sample.proftext based on the format specified in https://clang.llvm.org/docs/UsersManual.html#sample-profile-text-format, but maybe it's missing something that would allow hotness to be displayed?