[PATCH] D54021: [LoopSimplifyCFG] Teach LoopSimplifyCFG to constant-fold branches and switches

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 1 20:16:01 PDT 2018


mkazantsev created this revision.
mkazantsev added reviewers: escha, anna, skatkov, fedor.sergeev, reames.

This patch introduces infrastructure and the simplest case for constant-folding
of branch and switch instructions within loop into unconditional branches.
It is useful as a cleanup for such passes as loop unswitching that sometimes
produce such branches.

Only the simplest case supported in this patch: after the folding, no block
should become dead or stop being part of the loop. Support for more
sophisticated cases will go separately in follow-up patches.


https://reviews.llvm.org/D54021

Files:
  lib/Transforms/Scalar/LoopSimplifyCFG.cpp
  test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54021.172298.patch
Type: text/x-patch
Size: 11874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181102/c9d28747/attachment.bin>


More information about the llvm-commits mailing list