[PATCH] D57463: Add a module pass for order file instrumentation
Manman Ren via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 17 08:19:26 PDT 2021
manmanren added a comment.
In D57463#2823600 <https://reviews.llvm.org/D57463#2823600>, @thakis wrote:
>> is there any documentation on how to use this? I see that clang has a `-forder-file-instrumentation` switch to enable this. But what do I do after I enabled it? Run the instrumented program and then…? From the name, I'm guessing maybe the idea is that this will produce an order file?
I don't think I wrote a doc on this. Yes 'compiler-rt/test/profile/instrprof-order-file.test' shows how to use it, build the app with -forder-file-instrumentation and -mllvm -orderfile-write-mapping, then run the app, use the mapping file to decode the profile.
The profile should be in default.profraw.order. But you can change its name via:
- Writes to the file with the last name given to \a *
- __llvm_profile_set_filename(),
- or if it hasn't been called, the \c LLVM_PROFILE_FILE environment variable,
- or if that's not set, the last name set to INSTR_PROF_PROFILE_NAME_VAR,
- or if that's not set, \c "default.profraw".
Hope this helps!
Manman
> Looks like `compiler-rt/test/profile/instrprof-order-file.test` gives a demo for how this is supposed to be used: `clang -forder-file-instrumentation -O1 compiler-rt/test/profile/Inputs/instrprof-order-file-2.c compiler-rt/test/profile/Inputs/instrprof-order-file.c -mllvm -orderfile-write-mapping="mapping.txt"`, i.e. it needs an `-mllvm` flag to make it have an effect.
In D57463#2823575 <https://reviews.llvm.org/D57463#2823575>, @thakis wrote:
> Hi,
>
> is there any documentation on how to use this? I see that clang has a `-forder-file-instrumentation` switch to enable this. But what do I do after I enabled it? Run the instrumented program and then…? From the name, I'm guessing maybe the idea is that this will produce an order file?
>
> Part of why I'm asking is because I'm trying to teach lld/mac about `section$start$` symbols, but with a candidate patch I'm still getting `undefined symbol: section$start$__DATA$__llvm_orderfile`. It's well possible my patch is wrong, but I don't see what's supposed to create the `__llvm_orderfile` section (https://bugs.chromium.org/p/chromium/issues/detail?id=1220128#c10 has the candidate patch).
>
> Thanks,
> Nico
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57463/new/
https://reviews.llvm.org/D57463
More information about the llvm-commits
mailing list