[PATCH] D124554: [SimpleLoopUnswitch] Freeze individual OR/AND operands.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 13:51:44 PDT 2022


fhahn created this revision.
fhahn added reviewers: asbirlea, reames, nlopes, aqjune, nikic.
Herald added a subscriber: hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a project: LLVM.

In some cases, it is not enough to freeze the final AND/OR operation
when chaining a number of invariant conditions together.

After creating a chain of ANDs/ORs, we assume all unswitched operands to
be either true or false. But if any of the operands is poison, the rest
of the operands could have any value after branching on the frozen
condition.

To avoid that, freeze individual operands, if needed. In some cases this
may lead to unnecessary freezes, but it seems required at least for some
cases (see trivial-unswitch-freeze-individual-conditions.ll)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124554

Files:
  llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
  llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-freeze-individual-conditions.ll
  llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-logical-and-or.ll
  llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124554.425603.patch
Type: text/x-patch
Size: 10701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220427/cdea5468/attachment.bin>


More information about the llvm-commits mailing list