[all-commits] [llvm/llvm-project] fdd3e2: [DAG] SelectionDAG::getNode(N1, N2) - detect N2 con...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Thu Jan 27 02:59:40 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fdd3e2c9438d0e6b8a3e2d0d1ed848d39fa25f97
      https://github.com/llvm/llvm-project/commit/fdd3e2c9438d0e6b8a3e2d0d1ed848d39fa25f97
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-01-27 (Thu, 27 Jan 2022)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/AArch64/neon-bitwise-instructions.ll
    M llvm/test/CodeGen/ARM/2013-07-29-vector-or-combine.ll
    M llvm/test/CodeGen/X86/vec_smulo.ll

  Log Message:
  -----------
  [DAG] SelectionDAG::getNode(N1,N2) - detect N2 constant vector splats as well as scalars

We already perform some basic folds (add/sub with zero etc.) on scalar types, this patch adds some basic support for constant splats as well in a few cases (we can add more with future test coverage).

In the cases I've enabled, we can handle buildvector implicit truncation as we're not creating new constant nodes from the vector types - we're just returning existing nodes. This allows us to get a number of extra cases in the aarch64 tests.

I haven't enabled support for undefs in buildvector splats, as we're often checking for zero/allones patterns that return the original constant and we shouldn't be returning undef elements in some of these cases - we can enable this later if we're OK with creating new constants.

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




More information about the All-commits mailing list