aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2016-06-03 20:22:40 +0000
committerTom Stellard <thomas.stellard@amd.com>2016-06-03 20:22:40 +0000
commit910d7123e0fdd98ed689d812ed6207cfb3a01f39 (patch)
treea1e19dd8661ee585ebb9bb730f03a1118868add0
parentd909615c7cdcf85c86e3ad6b4ecaf8b55ee54ba6 (diff)
downloadllvm-910d7123e0fdd98ed689d812ed6207cfb3a01f39.zip
llvm-910d7123e0fdd98ed689d812ed6207cfb3a01f39.tar.gz
llvm-910d7123e0fdd98ed689d812ed6207cfb3a01f39.tar.bz2
Merging r262577:
------------------------------------------------------------------------ r262577 | thomas.stellard | 2016-03-02 19:45:09 -0800 (Wed, 02 Mar 2016) | 12 lines AMDGPU/SI: Don't try to move scratch wave offset when there are no free SGPRs Summary: When there were no free SGPRs, we were trying to move this value into some of the reserved registers which was causing a segmentation fault. Reviewers: arsenm Subscribers: arsenm, llvm-commits Differential Revision: http://reviews.llvm.org/D17590 ------------------------------------------------------------------------ llvm-svn: 271720
-rw-r--r--llvm/lib/Target/AMDGPU/SIFrameLowering.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
index bb875c9..d068b8d 100644
--- a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
@@ -165,10 +165,22 @@ void SIFrameLowering::emitPrologue(MachineFunction &MF,
if (ScratchWaveOffsetReg == TRI->reservedPrivateSegmentWaveByteOffsetReg(MF)) {
MachineRegisterInfo &MRI = MF.getRegInfo();
- // Skip the last 2 elements because the last one is reserved for VCC, and
- // this is the 2nd to last element already.
unsigned NumPreloaded = MFI->getNumPreloadedSGPRs();
- for (MCPhysReg Reg : getAllSGPRs().drop_back(6).slice(NumPreloaded)) {
+
+ // We need to drop register from the end of the list that we cannot use
+ // for the scratch wave offset.
+ // + 2 s102 and s103 do not exist on VI.
+ // + 2 for vcc
+ // + 2 for xnack_mask
+ // + 2 for flat_scratch
+ // + 4 for registers reserved for scratch resource register
+ // + 1 for register reserved for scratch wave offset. (By exluding this
+ // register from the list to consider, it means that when this
+ // register is being used for the scratch wave offset and there
+ // are no other free SGPRs, then the value will stay in this register.
+ // ----
+ // 13
+ for (MCPhysReg Reg : getAllSGPRs().drop_back(13).slice(NumPreloaded)) {
// Pick the first unallocated SGPR. Be careful not to pick an alias of the
// scratch descriptor, since we haven’t added its uses yet.
if (!MRI.isPhysRegUsed(Reg)) {