[DAG] Allow isNullOrNullSplat to see truncated zeroes
authorDavid Green <david.green@arm.com>
Tue, 8 Jun 2021 09:18:58 +0000 (10:18 +0100)
committerDavid Green <david.green@arm.com>
Tue, 8 Jun 2021 09:18:58 +0000 (10:18 +0100)
commitb889c6ee9911b72a58986d528f42dd18cbdf92d7
tree1521bcd561d39b671b954748dfe1eebe47e123d3
parentb34da6ff9c1d72816d0c9b87d5f0e879850bc424
[DAG] Allow isNullOrNullSplat to see truncated zeroes

This sets the AllowTruncation flag on isConstOrConstSplat in
isNullOrNullSplat, allowing it to see truncated constant zeroes on
architectures such as AArch64, where only a i32.i64 are legal. As a
truncation of 0 is always 0, this should always be valid, allowing some
extra folding to happen including some of the cases from D103755.

Differential Revision: https://reviews.llvm.org/D103756
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/AArch64/vecreduce-bool.ll
llvm/test/CodeGen/RISCV/rvv/vdiv-sdnode-rv32.ll
llvm/test/CodeGen/RISCV/rvv/vdiv-sdnode-rv64.ll
llvm/test/CodeGen/RISCV/rvv/vrem-sdnode-rv32.ll
llvm/test/CodeGen/RISCV/rvv/vrem-sdnode-rv64.ll