[PATCH] D21725: [LoopUnswitch] Unswitch on conditions feeding into guards
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 25 00:52:19 PDT 2016
sanjoy created this revision.
sanjoy added a reviewer: majnemer.
sanjoy added a subscriber: llvm-commits.
Herald added subscribers: mzolotukhin, mcrosier.
This is a straightforward extension of what LoopUnswitch does to
branches to guards. That is, we unswitch
```
for (;;) {
...
guard(loop_invariant_cond);
...
}
```
into
```
if (loop_invariant_cond) {
for (;;) {
...
// There is no need to emit guard(true)
...
}
} else {
for (;;) {
...
guard(false);
// SimplifyCFG will clean this up by adding an
// unreachable after the guard(false)
...
}
}
```
http://reviews.llvm.org/D21725
Files:
lib/Transforms/Scalar/LoopUnswitch.cpp
test/Transforms/LoopUnswitch/guards.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21725.61887.patch
Type: text/x-patch
Size: 5039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160625/dec50f35/attachment.bin>
More information about the llvm-commits
mailing list