[llvm-dev] PHI / Select Simplification

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Sat Mar 16 02:02:32 PDT 2019


On Sat, 16 Mar 2019 at 04:28, William Moses via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> This type of structure comes up frequently in some codes I'm looking at and figured I'd check if anyone has something to deal with it already before I implement my own (and try to upstream).

This seems to be done by a combination of Correlated Value Propagation
(which forwards %inner_value to the phi) and InstCombine (which
removes the now-dead select) on a simple example I fleshed out
(attached here). You can try it out with "opt -correlated-propagation
-instcombine -S simple.ll".

It's possible the value propagation isn't clever enough for your real
code, in which case it's probably still the best place to look at
fixing things in LLVM rather than adding a new pass.

Cheers.

Tim.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple.ll
Type: application/octet-stream
Size: 473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190316/16cb52d6/attachment.obj>


More information about the llvm-dev mailing list