[PATCH] D151403: [LoopPeel] Peel iterations based on and, or conditions

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 06:58:20 PDT 2023


nikic added a comment.

In D151403#4370799 <https://reviews.llvm.org/D151403#4370799>, @caojoshua wrote:

> This patch looks at ALL and/or's in the loop. In https://reviews.llvm.org/D151052, @nikic recommended that we only look at and/or's that are used by selects and branches. I think its beneficial to look at the ALL and/or's for the following reasons:
>
> 1. We can look at nested and/or's, which won't be used directly by branch/select.

We can still inspect the whole and/or tree rooted at a condition.

> 2. We can look at and/or's used in other ways. For example, it can be passed to a function.

I believe we should explicitly *not* peel such cases. Peeling is an aggressive transform that trades code size for potential simplification opportunities. If the peeled comparison is not used as a branch or select condition, we likely will not get any worthwhile simplification out of it. There is not much value in making a function argument constant true/false, at least not at this pipeline position.

If we did want to peel such cases, then the way to do that would be to forget about branches, selects, and/ors completely and simply peel all icmps.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151403/new/

https://reviews.llvm.org/D151403



More information about the llvm-commits mailing list