[RISCV][SelectionDAG] Add a hook to sign extend i32 ConstantInt operands of phis...
authorCraig Topper <craig.topper@sifive.com>
Mon, 11 Apr 2022 21:29:01 +0000 (14:29 -0700)
committerCraig Topper <craig.topper@sifive.com>
Mon, 11 Apr 2022 21:38:39 +0000 (14:38 -0700)
commit2ce25628760ab2bbab764fc48c086704b4d6e279
tree091ea4b520ec23fa9db53f2be83b80758ac52774
parent5c6db1dc9b839b2e37c115c12fb1aed0bc877671
[RISCV][SelectionDAG] Add a hook to sign extend i32 ConstantInt operands of phis on RV64.

Materializing constants on RISCV is simpler if the constant is sign
extended from i32. By default i32 constant operands of phis are
zero extended.

This patch adds a hook to allow RISCV to override this for i32. We
have an existing isSExtCheaperThanZExt, but it operates on EVT which
we don't have at these places in the code.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D122951
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h
llvm/test/CodeGen/RISCV/aext-to-sext.ll