OSDN Git Service

AMDGPU/SI: Avoid creating unnecessary copies in the SIFixSGPRCopies pass
authorTom Stellard <thomas.stellard@amd.com>
Wed, 16 Nov 2016 18:42:17 +0000 (18:42 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 16 Nov 2016 18:42:17 +0000 (18:42 +0000)
commitae5ecee3eca91869c3476ad209393273bd08ce1e
tree20b705863f68297774ea6c25ddcacc197ca1ae8a
parent76141b415765e57c8c862a4f81aec09384ec3877
AMDGPU/SI: Avoid creating unnecessary copies in the SIFixSGPRCopies pass

Summary:
1. Don't try to copy values to and from the same register class.
2. Replace copies with of registers with immediate values with v_mov/s_mov
   instructions.

The main purpose of this change is to make MachineSink do a better job of
determining when it is beneficial to split a critical edge, since the pass
assumes that copies will become move instructions.

This prevents a regression in uniform-cfg.ll if we enable critical edge
splitting for AMDGPU.

Reviewers: arsenm

Subscribers: arsenm, kzhuravl, llvm-commits

Differential Revision: https://reviews.llvm.org/D23408

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287131 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AMDGPU/SIInstrInfo.cpp
lib/Target/AMDGPU/SIInstrInfo.h
lib/Target/AMDGPU/SIRegisterInfo.cpp
lib/Target/AMDGPU/SIRegisterInfo.h
test/CodeGen/AMDGPU/control-flow-fastregalloc.ll
test/CodeGen/AMDGPU/insert_vector_elt.ll
test/CodeGen/AMDGPU/scratch-buffer.ll
test/CodeGen/AMDGPU/si-instr-info-correct-implicit-operands.ll