[RISCV] Move VSPILL/VRELOAD expansion for vector tuples to eliminateFrameIndex.
authorCraig Topper <craig.topper@sifive.com>
Tue, 6 Dec 2022 23:15:20 +0000 (15:15 -0800)
committerCraig Topper <craig.topper@sifive.com>
Tue, 6 Dec 2022 23:42:00 +0000 (15:42 -0800)
commit8d30b9e64f7e4140c5eba9099b9a26ac7f806233
tree9b00b43cc064086fcf6b72371f784e4b681b9159
parent8e0abf8d61e2a4339ea017be103a175f5f8b8778
[RISCV] Move VSPILL/VRELOAD expansion for vector tuples to eliminateFrameIndex.

We need a scratch GPR to increment the base pointer for each subsequent
register. We currently reuse the input GPR for the base pointer without
declaring it as a Def of the pseudo.

We can't add it as a Def of the pseudo at creation time because it doesn't
get register allocated. This was tried in D109405.

Seems the only choice we have is to scavenge the GPR. This patch
moves the expansion to eliminateFrameIndex where we can create
virtual registers that will be scavenged. This also eliminates the
extra operand for passing vlenb from frame lowering to expand pseudos.

I need to do more testing on real world code, but wanted to get this
up for early review.

I hope this will fix the issue reported in D123394, but I haven't
checked yet.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D139169
llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
llvm/lib/Target/RISCV/RISCVRegisterInfo.h
llvm/test/CodeGen/RISCV/rvv/undef-subreg-range.mir [deleted file]
llvm/test/CodeGen/RISCV/rvv/vmv-copy.mir
llvm/test/CodeGen/RISCV/rvv/zvlsseg-spill.mir