[all-commits] [llvm/llvm-project] 560263: [LoopPeel] Peel iterations based on and, or condit...

Joshua Cao via All-commits all-commits at lists.llvm.org
Sat Dec 2 11:24:16 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5602636835e3fe655d196428091a64abd1837966
      https://github.com/llvm/llvm-project/commit/5602636835e3fe655d196428091a64abd1837966
  Author: Joshua Cao <cao.joshua at yahoo.com>
  Date:   2023-12-02 (Sat, 02 Dec 2023)

  Changed paths:
    M llvm/lib/Transforms/Utils/LoopPeel.cpp
    M llvm/test/Transforms/LoopUnroll/peel-loop-conditions.ll

  Log Message:
  -----------
  [LoopPeel] Peel iterations based on and, or conditions (#73413)

For example, this allows us to peel this loop with a `and`:
```
for (int i = 0; i < N; ++i) {
  if (i % 2 == 0 && i < 3) // can peel based on || as well
    f1();
  f2();
```
into:
```
for (int i = 0; i < 3; ++i) { // peel three iterations
  if (i % 2 == 0)
    f1();
  f2();
}
for (int i = 3; i < N; ++i)
  f2();
```




More information about the All-commits mailing list