<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/117969>117969</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [llvm-profgen][PGO] Error when processing sampling based PGO for clang
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          hrtan99
      </td>
    </tr>
</table>

<pre>
    I'm trying to build clang for sampling based PGO to improve the performance of clang itself.

Command I used to build:
```
cmake -S llvm -B build_sample -G Ninja \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_ENABLE_PROJECTS='clang;compiler-rt' \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=/home/tanhuiri/projects/llvm-project/build_dev/bin/clang \
-DCMAKE_CXX_COMPILER=/home/tanhuiri/projects/llvm-project/build_dev/bin/clang++ \
-DLLVM_USE_LINKER=mold \
-DCMAKE_C_FLAGS='-O2 -gline-tables-only -fdebug-info-for-profiling -fno-inline' \
-DCMAKE_CXX_FLAGS='-O2 -gline-tables-only -fdebug-info-for-profiling -fno-inline' \
-DCMAKE_EXE_LINKER_FLAGS='-O2 -gline-tables-only -fdebug-info-for-profiling -fno-inline'
```

Then I use `perf` to run a compile command, which use the built clang of above to compile a sqlite3 source file, and collecting the profile data:
```
perf record -b -e BR_INST_RETIRED.NEAR_TAKEN:uppp -F 5000 -- /home/tanhuiri/projects/llvm-project/build_sample/bin/clang sqlite3.c -c -o sqlite3.o
```

Next, I try to convert this profile data into llvm's profile format using `llvm-profgen`:
```
llvm-profgen --binary=/home/tanhuiri/projects/llvm-project/build_sample/bin/clang --output=clang.prof --perfdata=perf.data
```

But the `llvm-profgen` report error:
```
llvm-profgen: error: No relevant mmap event is found in perf data.
```


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VVFvozg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