[RISCV] Add new pass to transform undef to pseudo for vector values.
authorPiyou Chen <piyou.chen@sifive.com>
Wed, 15 Feb 2023 03:42:26 +0000 (19:42 -0800)
committerPiyou Chen <piyou.chen@sifive.com>
Wed, 15 Feb 2023 03:42:44 +0000 (19:42 -0800)
commitf1c4241fb6e50c507adafbe14faf82a755ab92ca
tree917a034319a4f850ca593fe0d7a272bb572dd438
parenta17bfbad6387bf0704bdc5a95c72bd84c6c7f7a1
[RISCV] Add new pass to transform undef to pseudo for vector values.

RISC-V vector instruction has register overlapping constraint for certain
instructions, and will cause illegal instruction trap if violated, we use
early clobber to model this constraint, but it can't prevent register allocator
allocated same or overlapped if the input register is undef value, so convert
IMPLICIT_DEF to temporary pseudo could prevent that happen, it's not best way
to resolve this. Ideally we should model the constraint right, but before we
model the constraint right, it's the approach to prevent that happen.

See also: https://github.com/llvm/llvm-project/issues/50157

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D129735
llvm/lib/Target/RISCV/CMakeLists.txt
llvm/lib/Target/RISCV/RISCV.h
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
llvm/lib/Target/RISCV/RISCVInstrInfo.td
llvm/lib/Target/RISCV/RISCVRVVInitUndef.cpp [new file with mode: 0644]
llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
llvm/test/CodeGen/RISCV/O3-pipeline.ll
llvm/test/CodeGen/RISCV/regalloc-last-chance-recoloring-failure.ll
llvm/test/CodeGen/RISCV/rvv/subregister-undef-early-clobber.mir
llvm/test/CodeGen/RISCV/rvv/undef-earlyclobber-chain.ll
llvm/test/CodeGen/RISCV/rvv/vrgatherei16-subreg-liveness.ll