[llvm] [Instrumentation] Fix EdgeCounts vector size in SetBranchWeights (PR #99064)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 11:30:44 PDT 2024


ellishg wrote:

Here is a reproducer. (I've uploaded files with the `.txt` suffix to satisfy GitHub's file uploader)
[foo.ll.txt](https://github.com/user-attachments/files/16617387/foo.ll.txt)
[foo.proftext.txt](https://github.com/user-attachments/files/16617390/foo.proftext.txt)

```
$ llvm-profdata merge foo.proftext -o foo.profdata
$ opt --passes=pgo-instr-use -pgo-test-profile-file=foo.profdata < foo.ll -o /dev/null
```

I used the `llvm-reduce` tool, but the crash only occurs if the profile matches the function's CFG, and the tool can't reduce both the IR and the profile at the same time. I'm sure we could further reduce this testcase by simplifying the CFG, but hopefully this gives us some insight into the root problem.

https://github.com/llvm/llvm-project/pull/99064


More information about the llvm-commits mailing list