[PATCH] D28414: Simplify conditional branch on constant condition and remove unreachable blocks.

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 14:17:23 PST 2017


trentxintong created this revision.
trentxintong added reviewers: hfinkel, davidxl, mkuper, mzolotukhin, anemet.
trentxintong added a subscriber: llvm-commits.

we can turn the branch with const condition into a unconditional branch.

With this transformation, we can then run a dead block deletion algorithm to remove unreachable blocks in the loop.

This is useful as the next time we unswitch this loop, we will have fewer
blocks to duplicate and fewer instructions to remap, etc.

This should also give us a better idea of the real unswitch cost of the
loop (even though we still cant use this information right now).

Additionally, its good for us to clean up as soon as possible in loop unswitch,
otherwise we duplicate a lot of dead code which need to be cleaned up by
later passes, this is suboptimal as this leads to more compilation time.

Note: I have not fixed all the LIT tests yet. There are quite a number of them to FIX. I will upload again once
I fix them.


https://reviews.llvm.org/D28414

Files:
  lib/Transforms/Scalar/LoopUnswitch.cpp
  test/Transforms/LoopUnswitch/trivial-unswitch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28414.83428.patch
Type: text/x-patch
Size: 4109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170106/e5796db2/attachment.bin>


More information about the llvm-commits mailing list