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

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 09:23:04 PST 2022


RKSimon created this revision.
RKSimon added reviewers: spatel, dmgreen, craig.topper, efriedma.
Herald added subscribers: pengfei, hiraditya, kristof.beyls.
RKSimon requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118264

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118264.403312.patch
Type: text/x-patch
Size: 4541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220126/5c119e15/attachment.bin>


More information about the llvm-commits mailing list