Hi,
I am using sample-based PGO and llvm-profgen recently and found a bug in llvm-profgen. The bug is on line 529 of main/llvm/tools/llvm-profgen/ProfiledBinary.cpp (as shown in the figure below). The details are as follows:
I encountered such a CallFrame whose Line is 0 and StartLine is non-zero (Line and StartLine are both uint32_t). This caused LineOffset to exceed the 16-bit range (checked by line 97 of main/llvm/lib/ProfileData/SampleProfReader.cpp), and report error (error type shown on line 301 of main/llvm/lib/ProfileData/SampleProfReader.cpp).
I studied the case where CallFrame.Line is equal to 0 in Spec CPU 2017-502.gcc_r. And I found that: if the assembly line related to the CallFrame is mapped to multiple source line, we tried to obtain the CallFrame.Line and get 0. This is because Dwarf information shows 0 for line in this case when the mapped source line can not be determined.
I wonder that how to solve this error.
Qingqing Xu