[RISCV] Fix crash a vector add has a 4x sext and zext operand.
authorCraig Topper <craig.topper@sifive.com>
Mon, 31 Oct 2022 19:37:51 +0000 (12:37 -0700)
committerCraig Topper <craig.topper@sifive.com>
Mon, 31 Oct 2022 22:10:27 +0000 (15:10 -0700)
commit2a827e4a988b614bc6f70abe00308ceeb50dcd0a
treebce0102d848a070ac052efc0aaef2e80088bd6bf
parentcc2cf8b22b35a9cf87a61bf66c259455185fa6e3
[RISCV] Fix crash a vector add has a 4x sext and zext operand.

We can narrow one of the extends and keep the other original by
using a vwaddu.wv or vwadd.wv.

We were previously forgetting to keep the original operand and
instead took the source of its extend. This resulted in a type
mismatch that later failed with an impossible physical register copy.

To fix this I've refactored some code to maintain information about
whether the source needs to be extended at all for longer so we could
use it in materialize.

Differential Revision: https://reviews.llvm.org/D137106
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vwaddu.ll