[PATCH] D151677: [SimpleLoopUnswitch] Unswitch AND/OR conditions of selects

Joshua Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 29 21:55:49 PDT 2023


caojoshua created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
caojoshua added reviewers: nikic, fhahn, mkazantsev.
Herald added a subscriber: StephenFan.
caojoshua published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

If a select's condition is a AND/OR, we can unswitch invariant operands.
This patch uses existing logic from unswitching AND/OR's for branch
conditions.

This patch also fixes the Cost computation for unswitching
selects/guards to have the cost of the entire loop, since unswitching
selects/guards do not remove branches. This is required for this patch
because otherwise, there are cases where unswitching selects of AND/OR
is beating out unswitching of branches.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151677

Files:
  llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
  llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151677.526507.patch
Type: text/x-patch
Size: 15673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230530/5927243f/attachment.bin>


More information about the llvm-commits mailing list