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

Joshua Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 09:27:26 PDT 2023


caojoshua added a comment.

> 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.

There is value in making an argument of a and/or constant, since it always folds the and/or in peeled loops. This would be similar to peeling select conditions. We won't necessarily eliminate any branches in the loop, but we can at least fold the select/and/or instruction.

For code size, maybe it would be good to have some cost function to only peel small loops (don't think this is a thing right now).


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