llvm-project
llvm-project copied to clipboard
[RISCV] Unnecessary move of undefined with subregister liveness enabled
define void @repeat_shuffle(<2 x double> %v, ptr noalias %q) {
%w = shufflevector <2 x double> %v, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
store <4 x double> %w, ptr %q
ret void
}
When compiled with llc -mattr=+v, there's an unnecessary vmv1r.v v13, v10 emitted, which copies an implicit def to v13.
repeat_shuffle: # @repeat_shuffle
.cfi_startproc
# %bb.0:
vmv2r.v v12, v8
vsetivli zero, 4, e64, m2, ta, ma
vmv1r.v v13, v10
vslideup.vi v8, v12, 2
vse64.v v8, (a0)
ret
Compiling with -riscv-enable-subreg-liveness=0 avoids this:
repeat_shuffle: # @repeat_shuffle
.cfi_startproc
# %bb.0:
# kill: def $v8 killed $v8 def $v8m2
vsetivli zero, 4, e64, m2, ta, ma
vmv2r.v v10, v8
vslideup.vi v10, v8, 2
vse64.v v10, (a0)
ret
@llvm/issue-subscribers-backend-risc-v
cc: @BeMg
This patch fix it.
Fixed via https://github.com/llvm/llvm-project/commit/1e86abc914bb