[llvm] [SelectOpt] Optimise big select groups in the latch of a non-inner loop to branches (PR #119728)

Igor Kirillov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 07:06:23 PST 2024


igogo-x86 wrote:

The test shows an example of code that gets massive performance improvements on real-life benchmarks, and the heuristic is just as dumb as possible to achieve that effect.

Alternatively, we could check that a group has select-like instructions and convert it in any outer block, not only latch. I guess we better let the model decide what to do for inner loops.
A more complicated heuristic would be to convert if select-like instructions in a big group have loop-carried dependencies:

```
for () {
  for () {
     ... a[i]...
  }
  if (cond)
    ++i;
}
```

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


More information about the llvm-commits mailing list