[PATCH] D46706: [PM/LoopUnswitch] Support partial trivial unswitching.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 10 10:38:23 PDT 2018


chandlerc created this revision.
chandlerc added reviewers: sanjoy, fedor.sergeev.
Herald added subscribers: mgrang, hiraditya, mcrosier.

The idea of partial unswitching is to take a *part* of a branch's
condition that is loop invariant and just unswitching that part. This
primarily makes sense with i1 conditions of branches as opposed to
switches. When dealing with i1 conditions, we can easily extract loop
invariant inputs to a a branch and unswitch them to test them entirely
outside the loop.

As part of this, we now create much more significant cruft in the loop
body, so this includes changes to enhance our cleanup to simplify and
delete the instructions that become truly uninteresting after the
unswitch. There is no attempt to make this comprehensive, so it still
make sense to do some other loop-cleanup passes after unswitching.

This already appears to be more powerful at unswitching than the old
loop unswitch pass, and so I'd appreciate pretty careful review in case
I'm just missing some correctness checks. The `LIV-loop-condition` test
case is not unswitched by the old unswitch pass, but is with this pass.


Repository:
  rL LLVM

https://reviews.llvm.org/D46706

Files:
  llvm/include/llvm/Analysis/Utils/Local.h
  llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/test/Transforms/SimpleLoopUnswitch/LIV-loop-condtion.ll
  llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46706.146156.patch
Type: text/x-patch
Size: 21392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180510/c33db1a6/attachment.bin>


More information about the llvm-commits mailing list