Issue 55528
Summary [ORC] Perf profiling integration not working in lli
Labels new issue
Assignees
Reporter tetzank
    The `perf` profiling integration in `lli` does not work with the ORC jit engine. There are no JitDump files created in ~/.debug/jit/. Hence, `perf report` does not know function addresses and boundaries of jitted code.

The following steps work for MCJIT (--jit-kind=mcjit), but not ORC. LLVM needs to be build with perf support: LLVM_USE_PERF=ON.

Simple C program *pi.c* to test profiling:
```C
#include <stdlib.h>
#include <stdio.h>

static double pi(size_t n){
        double res = 4.0;
        for(size_t i=0,v=3; i<n; ++i,v+=4){
                res -= 4.0 / (v);
                res += 4.0 / (v+2);
        }
        return res;
}

int main(int argc, char *argv[]){
        if(argc != 2){
                puts("requires n as input");
                return -1;
        }
        size_t n = atoi(argv[1]);
        double p = pi(n);
        printf("%lu: %f\n", n, p);
        return 0;
}
```
Convert to LLVM IR:
`$ clang -S -emit-llvm pi.c -o pi.ll`

Profile execution:
```
$ perf record -k 1 lli --jit-kind=mcjit pi.ll 100000000
$ perf inject -j -i perf.data -o perf.data.jitted
$ perf report -i perf.data.jitted
```
Without `--jit-kind=mcjit`, ORC is used by default which does not produce dump files. Therefore, `perf report` does not know about the jitted code.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to