Profile runtime can generate an empty profile (when there is no function in the shared library). This empty profile is treated as a text format profile. A test format profile without the flag of "#IR" is thought to be a clang generated profile. So in llvm profile merging, we will get a bogus warning of "Merge IR generated profile with Clang generated profile."
The fix here is to skip the empty profile (when the buffer size is 0) by returning nullptr in InstrProfReader::create().
This patch also fixes a use-after-move instance in loadInput() in llvm-profdata.cpp.