使用llvm-prof进行分析时传递命令行参数

时间:2013-11-20 13:17:15

标签: llvm

在使用llvm-prof?

进行分析时,如何将命令行参数传递给我的程序

我在哪里可以找到更全面的llvm-prof文档? “llvm-prof -help”输出太简短了。它的手册更短。

2 个答案:

答案 0 :(得分:4)

我建议此时远离llvm-prof。原因是它实际上是在一个月前从主干LLVM中删除的(修订版191835)。这是应该澄清动机的提交消息:

Remove the very substantial, largely unmaintained legacy PGO
infrastructure.

This was essentially work toward PGO based on a design that had several
flaws, partially dating from a time when LLVM had a different
architecture, and with an effort to modernize it abandoned without being
completed. Since then, it has bitrotted for several years further. The
result is nearly unusable, and isn't helping any of the modern PGO
efforts. Instead, it is getting in the way, adding confusion about PGO
in LLVM and distracting everyone with maintenance on essentially dead
code. Removing it paves the way for modern efforts around PGO.

Among other effects, this removes the last of the runtime libraries from
LLVM. Those are being developed in the separate 'compiler-rt' project
now, with somewhat different licensing specifically more approriate for
runtimes.

答案 1 :(得分:1)

您撰写问题的方式意味着您尝试使用llvm-prof执行程序。但是我不确定这是否是这样做的。配置文件的方法是首先使用以下方法使用计数器检测代码:

opt -disable-opt -insert-edge-profiling -o program.profile.bc program.bc

然后使用lli执行检测程序,如下所示:

lli -O0 -fake-argv0 'program.bc < YOUR_ARGS' -load llvm/Debug+Asserts/lib/libprofile_rt.so program.profile.bc

注意使用上面的-fake-argv0 'program.bc < YOUR_ARGS'将参数传递给程序的方法。此步骤将生成llvmprof.out文件,然后可以使用llvm-prof读取该文件以生成执行配置文件,如下所示:

llvm-prof program.profile.bc