[llvm-dev] bug in llvm-profgen

徐青青 via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 12 20:21:30 PDT 2021


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210912/bb72a45d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 截屏2021-09-13 上午10.21.17.png
Type: image/png
Size: 253282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210912/bb72a45d/attachment-0001.png>


More information about the llvm-dev mailing list