Profiling with LLVM/Clang under OSX

I am having trouble finding a simple example of profiling with the LLVM
toolchain - can anyone assist?

- If I want to use llvm-prof, should I be using "-pg" or does that produce a
non-llvm-prof compatible profiling code?
- Should I be using "-emit-llvm" to
- Can OSX be configured to execute bitcode files directly?
- Is there a simple Makefile example for a profile build?

I am using Xcode in external build configuration. If anyone knows how to use
the static analyser/profiling in the native UI in this configuration - let
me know :slight_smile:

fil wrote

I am having trouble finding a simple example of profiling with the LLVM
toolchain - can anyone assist?

- If I want to use llvm-prof, should I be using "-pg" or does that produce
a non-llvm-prof compatible profiling code?
- Should I be using "-emit-llvm" to
- Can OSX be configured to execute bitcode files directly?
- Is there a simple Makefile example for a profile build?

I am using Xcode in external build configuration. If anyone knows how to
use the static analyser/profiling in the native UI in this configuration -
let me know :slight_smile:

To answer my own question:

All the info on profiling with native LLVM tools seems a bit dated/thin
(clang++ -emit-llvm, opt, clang++ link, run ==> llvmprof.out, llvm-prof). I
actually settled on using the "Instruments" tool that comes with Xcode -
works pretty well, I just need to work out how to generate dSYM's from my
Makefile build so I can get links to source working.