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)
commit0d162b1c4f274a21ad9d3e92239245db56704c24
treeec17cd78a5a9a6b426d897cef3e15c7b00acd81d
parentcaf280330f0451005a7a46233a7a4f9520123f31
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

llvm-svn: 287131
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
llvm/lib/Target/AMDGPU/SIInstrInfo.h
llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
llvm/lib/Target/AMDGPU/SIRegisterInfo.h
llvm/test/CodeGen/AMDGPU/control-flow-fastregalloc.ll
llvm/test/CodeGen/AMDGPU/insert_vector_elt.ll
llvm/test/CodeGen/AMDGPU/scratch-buffer.ll
llvm/test/CodeGen/AMDGPU/si-instr-info-correct-implicit-operands.ll