[all-commits] [llvm/llvm-project] 178636: [InstCombine] Fold select -> and/or using impliesP...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Jan 13 08:51:20 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 17863614da1efbe61e91c9f6f08ad80cdd257bb4
      https://github.com/llvm/llvm-project/commit/17863614da1efbe61e91c9f6f08ad80cdd257bb4
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-01-13 (Wed, 13 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-and-or.ll

  Log Message:
  -----------
  [InstCombine] Fold select -> and/or using impliesPoison

We can fold a ? b : false to a & b if is_poison(b) implies that
is_poison(a), at which point we're able to reuse all the usual fold
on ands. In particular, this covers the very common case of
icmp X, C && icmp X, C'. The same applies to ors.

This currently only has an effect if the
-instcombine-unsafe-select-transform=0 option is set.

Differential Revision: https://reviews.llvm.org/D94550




More information about the All-commits mailing list