[RISCV] Maintain fixed-length info when optimizing BUILD_VECTORs
authorFraser Cormack <fraser@codeplay.com>
Fri, 19 Mar 2021 10:17:06 +0000 (10:17 +0000)
committerFraser Cormack <fraser@codeplay.com>
Fri, 19 Mar 2021 17:21:06 +0000 (17:21 +0000)
commitd399b82e2ab26b38745852534e85771dee4de296
treeef492f48a8b3f567b412b7938730f62e241a75ed
parent6ca178cd78a99d682d0be43eff1a808c1bcf47e6
[RISCV] Maintain fixed-length info when optimizing BUILD_VECTORs

I'm not sure how I failed to notice this before, but when optimizing
dominant-element BUILD_VECTORs we would lower via the scalable container type,
which lost us the information about the fixed length of the vector types. By
lowering via the fixed-length type we can preserve that information and
eliminate redundant vsetvli instructions.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D98938
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-bswap.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-cttz.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-insert.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int.ll