Most functions in SampleProfWriter previously taking a
SampleProfileMap now take llvm::ArrayRef<NameFunctionSamples> instead.
The original write interface takes a SampleProfileMap and immediately
sorts it into a vector<NameFunctionSamples> before passing it down to
the actual write implementations.
The purpose of this change is to allow SampleProfWriter to take a slice
of the profile to write to file, instead of having to modify or
reconstruct a SampleProfileMap, which is very slow. In a following patch
I am going to enhance the functionality of reducing profile size limit,
which will make heavy use of the new SampleProfWriter interface.
using template to share code with flattenProfile above?