AMDGPU: Move SIFixSGPRLiveRanges to be a regalloc pass
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 1 Oct 2015 22:10:03 +0000 (22:10 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 1 Oct 2015 22:10:03 +0000 (22:10 +0000)
commita7474fd041dfd89ca05ebfc91d7085eabf1b8f87
tree1423daa22d3cbcc9fae52adf2c364e49928d4139
parentfd813994db6b4c9b6195ccff7113ed03366c67d0
AMDGPU: Move SIFixSGPRLiveRanges to be a regalloc pass

Replace LiveInterval usage with LiveVariables. LiveIntervals
computes far more information than is needed for this pass
which just needs to find if an SGPR is live out of the
defining block.

LiveIntervals are not usually available that early, requiring
computing them twice which is very expensive. The extra run of
LiveIntervals/LiveVariables/SlotIndexes was costing in total
about 5% of compile time.

Continuing to use LiveIntervals is problematic. It seems
there is an option (early-live-intervals) to run the analysis
about where it should go to avoid recomputing LiveVariables,
but it seems to be completely broken with subreg liveness
enabled. There are also problems from trying to recompute
LiveIntervals since this seems to undo LiveVariables
and clearing kill flags, causing TwoAddressInstructions
to make bad decisions.

Insert the pass right after live variables and preserve it.
The tricky case to worry about might be phis since
LiveVariables doesn't count a register as live out if
in the successor block it is only used in a phi,
but I don't think this is a concern right now
because SIFixSGPRCopies replaces SGPR phis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249087 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
lib/Target/AMDGPU/SIFixSGPRLiveRanges.cpp