[all-commits] [llvm/llvm-project] 3f906f: [InstSimplify] look through vector select (shuffle...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Fri Sep 30 05:27:18 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3f906f057c879e3867800d968113b5cb770d63a4
      https://github.com/llvm/llvm-project/commit/3f906f057c879e3867800d968113b5cb770d63a4
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-09-30 (Fri, 30 Sep 2022)

  Changed paths:
    M llvm/lib/Analysis/InstructionSimplify.cpp
    M llvm/test/Transforms/InstSimplify/select-maxmin.ll
    M llvm/test/Transforms/PhaseOrdering/vector-select.ll

  Log Message:
  -----------
  [InstSimplify] look through vector select (shuffle) in min/max fold

This is an extension of the existing min/max+select fold (which already
has a very large number of variations) to allow a vector shuffle because
that's what we have in the motivating example from issue #42100.

A couple of Alive2 checks of variants (I don't know how to generalize
these in Alive):
https://alive2.llvm.org/ce/z/jUFAqT

And verify the PR42100 test:
https://alive2.llvm.org/ce/z/3EcASf

It's possible there is some generalization of the fold or a
VectorCombine/SLP answer for the motivating test, but I haven't found a
better/smaller solution yet.

We can also add even more variants here as follow-up patches. For example,
we can have shuffle followed by min/max; we also don't have this
canonicalization or the reverse:
https://alive2.llvm.org/ce/z/StHD9f

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




More information about the All-commits mailing list