[PATCH] D81375: [InstCombine] Simplify boolean Phis with const inputs using CFG

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 04:52:12 PDT 2020


mkazantsev created this revision.
mkazantsev added reviewers: lebedev.ri, fhahn, spatel, DaniilSuchkov.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
mkazantsev edited the summary of this revision.
mkazantsev updated this revision to Diff 269172.
mkazantsev updated this revision to Diff 269173.
mkazantsev updated this revision to Diff 269174.

This patch adds simplification for pattern:

    if (cond)
    /       \
   ...      ...
    \       /
  phi [true] [false]

If we can prove that top block's branches dominate respective
inputs of a block that has a Phi with constant inputs, we can
use the branch condition (maybe inverted) instead of Phi.


https://reviews.llvm.org/D81375

Files:
  llvm/include/llvm/IR/Dominators.h
  llvm/lib/IR/Dominators.cpp
  llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
  llvm/test/Transforms/CallSiteSplitting/callsite-split.ll
  llvm/test/Transforms/InstCombine/icmp-constant-phi.ll
  llvm/test/Transforms/InstCombine/phi.ll
  llvm/test/Transforms/InstCombine/select.ll
  llvm/test/Transforms/InstCombine/simple_phi_condition.ll
  llvm/test/Transforms/PhaseOrdering/inlining-alignment-assumptions.ll
  llvm/test/Transforms/PhaseOrdering/simplifycfg-options.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81375.269174.patch
Type: text/x-patch
Size: 13577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200608/81713e20/attachment.bin>


More information about the llvm-commits mailing list