[llvm] [LoopPeeling] Fix weights updating of peeled off branches (PR #70094)
Aleksandr Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 30 10:42:20 PDT 2023
aleks-tmb wrote:
@MatzeB Hi, could you please take a look. Described issue manifested after your patch:
```
SHA: b30c9c937802a78ef986cb4219eba51148f76e6c
Author: Matthias Braun
Date: 2023-09-11 14:23:29 -0700 -0700
LoopUnrollRuntime: Add weights to all branches
```
Actually your patch added branch weights scaling. So imagine a loop with scaled latch weights ratio from 1:2 to 127:254 one. If we decide to peel 3 iterations of such loop, initial 1:2 ratio will be updated as:
```
0th peeled latch: 1:2
1st peeled latch: 1:1
2nd peeled latch: 1:1
```
And with initial 127:254:
```
0th peeled latch: 127:254
1st peeled latch: 127:127
2nd peeled latch: 127:1
```
So the hotness of the mail loop header changed from neutral 1:1 to 127:1, making it almost unreachable.
In my patch I tried to make it:
https://github.com/llvm/llvm-project/pull/70094
More information about the llvm-commits
mailing list