[all-commits] [llvm/llvm-project] 035446: [SimpleLoopUnswtich] Support zext when injecting i...

Max Kazantsev via All-commits all-commits at lists.llvm.org
Mon Mar 6 00:43:15 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0354463b9e77b909ec54526aa0375750b77c4282
      https://github.com/llvm/llvm-project/commit/0354463b9e77b909ec54526aa0375750b77c4282
  Author: Max Kazantsev <mkazantsev at azul.com>
  Date:   2023-03-06 (Mon, 06 Mar 2023)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
    M llvm/test/Transforms/SimpleLoopUnswitch/inject-invariant-conditions.ll

  Log Message:
  -----------
  [SimpleLoopUnswtich] Support zext when injecting invariant conditions

This patch handles the following case: turn
```
if (x <u Invariant1) {
  if (zext(x) <u Invariant2) {
    ...
  }
}
```
into
```
if (x <u Invariant1) {
  if (zext(Invariant1) <=u Invariant2) { // Unswitch here
    // No check needed
  } else {
    if (zext(x) <u Invariant2) {
      ...
    }
  }
}
```

Differential Revision: https://reviews.llvm.org/D138015
Reviewed By: skatkov




More information about the All-commits mailing list