[RISCV] Optimize SELECT_CC when the true value of select is Constant
authorLiaoChunyu <chunyu@iscas.ac.cn>
Tue, 18 Oct 2022 01:21:47 +0000 (09:21 +0800)
committerLiaoChunyu <chunyu@iscas.ac.cn>
Tue, 18 Oct 2022 01:24:17 +0000 (09:24 +0800)
commit7b970290c07f9d7fcbe36d00d3f3acc9ab7407cb
tree2b058cd21e8989a3512ceb79b2bfbd22a3ae4842
parent9f596a7c67cc10fbb624f8b55bf9637e1dddd1c2
[RISCV] Optimize SELECT_CC when  the true value of select is Constant

(select (setcc lhs, rhs, CC), constant, falsev) -> (select (setcc lhs, rhs, InverseCC), falsev, constant)

This patch removes unnecessary copies

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D129757
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/ctlz-cttz-ctpop.ll
llvm/test/CodeGen/RISCV/double-convert-strict.ll
llvm/test/CodeGen/RISCV/double-convert.ll
llvm/test/CodeGen/RISCV/float-convert-strict.ll
llvm/test/CodeGen/RISCV/float-convert.ll
llvm/test/CodeGen/RISCV/half-convert-strict.ll
llvm/test/CodeGen/RISCV/half-convert.ll
llvm/test/CodeGen/RISCV/rv32zbb.ll