AMDGPU: Reuse carry out register during FI elimination
authorAustin Kerbow <Austin.Kerbow@amd.com>
Fri, 22 Nov 2019 20:25:13 +0000 (12:25 -0800)
committerAustin Kerbow <Austin.Kerbow@amd.com>
Thu, 28 Nov 2019 18:13:48 +0000 (10:13 -0800)
commit256ad954a9e453e55b950207ca433da8da883a33
tree6b64e37e8b3350063cebb26554e11dce42e7165e
parentacd7fe8636ab1d892a935ca747ed9bb6420e2253
AMDGPU: Reuse carry out register during FI elimination

Summary:
Pre gfx9 we need to scavenge a 64-bit SGPR to use as the carry out for an Add.
If only one SGPR was available this crashed when trying to scavenge another
32bit SGPR to materialize the offset.

Instead, reuse a 32-bit SGPR from the carry out as the offset register.

Also prefer to use vcc for the unused carry out when it is available.

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70614
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
llvm/test/CodeGen/AMDGPU/pei-scavenge-sgpr-carry-out.mir