[RISCV] Improve constant materialization for stores of i16 or i32 negative constants.
authorCraig Topper <craig.topper@sifive.com>
Wed, 18 Aug 2021 17:23:59 +0000 (10:23 -0700)
committerCraig Topper <craig.topper@sifive.com>
Wed, 18 Aug 2021 17:25:12 +0000 (10:25 -0700)
commit20e62658735a1b03ecadc3072593753abca21fd0
tree7f519084ee4d98b519c21fadd6a9f37c66d3f707
parentd9ba1a9c5cac638a5cf3d23404509f7eeb434b7a
[RISCV] Improve constant materialization for stores of i16 or i32 negative constants.

DAGCombiner::visitStore can clear the upper bits of constants
used by stores. This leads prevents them from being recognized as
sign extended negative values making them more expensive to
materialize.

This patch uses the hasAllNBitUsers method from D107658 to make
a negative constant if none of the users care about the upper bits.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D108052
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
llvm/test/CodeGen/RISCV/calling-conv-half.ll
llvm/test/CodeGen/RISCV/imm.ll