[all-commits] [llvm/llvm-project] 831c22: [SimpleLoopUnswitch] Add unswitch select tests

Joshua Cao via All-commits all-commits at lists.llvm.org
Sat Apr 29 21:26:30 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 831c221e62b4c8f2efff519cb626b2b3a335b2dd
      https://github.com/llvm/llvm-project/commit/831c221e62b4c8f2efff519cb626b2b3a335b2dd
  Author: Joshua Cao <cao.joshua at yahoo.com>
  Date:   2023-04-29 (Sat, 29 Apr 2023)

  Changed paths:
    A llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-select.ll

  Log Message:
  -----------
  [SimpleLoopUnswitch] Add unswitch select tests


  Commit: e479ed90b591c18873fda68c12946b9d08cbe02f
      https://github.com/llvm/llvm-project/commit/e479ed90b591c18873fda68c12946b9d08cbe02f
  Author: Joshua Cao <cao.joshua at yahoo.com>
  Date:   2023-04-29 (Sat, 29 Apr 2023)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
    M llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-freeze.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-select.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-trivial-select.ll

  Log Message:
  -----------
  [SimpleLoopUnswitch] unswitch selects

The old LoopUnswitch pass unswitched selects, but the changes were never
ported to the new SimpleLoopUnswitch.

We unswitch by turning:

```
S = select %cond, %a, %b
```

into:

```
head:
br %cond, label %then, label %tail

then:
br label %tail

tail:
S = phi [ %a, %then ], [ %b, %head ]
```

Unswitch selects are always nontrivial, since the successors do not exit
the loop and the loop body always needs to be cloned.

Differential Revision: https://reviews.llvm.org/D138526

Co-authored-by: Sergey Kachkov <sergey.kachkov at syntacore.com>


Compare: https://github.com/llvm/llvm-project/compare/60f815d24113...e479ed90b591


More information about the All-commits mailing list