[PATCH] Support using sample profiles with partial debug info.

Diego Novillo dnovillo at google.com
Tue Oct 21 12:11:05 PDT 2014


Hi echristo, dblaikie,

When using a profile, we used to require the use -gmlt so that we could
get access to the line locations. This is used to match line numbers in
the input profile to the line numbers in the function's IR.

But this is actually not necessary. The driver can provide source
location tracking without the emission of debug information. In these
cases, the annotation 'llvm.dbg.cu' is missing from the IR, but the
actual line location annotations are still present.

This patch adds a new way of looking for the start of the current
function. Instead of looking through the compile units in llvm.dbg.cu,
we can walk up the scope for the first instruction in the function with
a debug loc. If that describes the function, we use it. Otherwise, we
keep looking until we find one.

If no such instruction is found, we then give up and produce a warning.
I changed the diagnostic from an error to a warning because it's not
really a codegen problem. The compiler can continue, it's just that the
optimization opportunities won't include profile information.

http://reviews.llvm.org/D5887

Files:
  lib/Transforms/Scalar/SampleProfile.cpp
  test/Transforms/SampleProfile/loc-tracking-only.ll
  test/Transforms/SampleProfile/syntax.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5887.15199.patch
Type: text/x-patch
Size: 8604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141021/73dd2d31/attachment.bin>


More information about the llvm-commits mailing list