llvm.org GIT mirror llvm / 1c569b0
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 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_38@271720 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 3 years ago
1 changed file(s) with 15 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
164164
165165 if (ScratchWaveOffsetReg == TRI->reservedPrivateSegmentWaveByteOffsetReg(MF)) {
166166 MachineRegisterInfo &MRI = MF.getRegInfo();
167 // Skip the last 2 elements because the last one is reserved for VCC, and
168 // this is the 2nd to last element already.
169167 unsigned NumPreloaded = MFI->getNumPreloadedSGPRs();
170 for (MCPhysReg Reg : getAllSGPRs().drop_back(6).slice(NumPreloaded)) {
168
169 // We need to drop register from the end of the list that we cannot use
170 // for the scratch wave offset.
171 // + 2 s102 and s103 do not exist on VI.
172 // + 2 for vcc
173 // + 2 for xnack_mask
174 // + 2 for flat_scratch
175 // + 4 for registers reserved for scratch resource register
176 // + 1 for register reserved for scratch wave offset. (By exluding this
177 // register from the list to consider, it means that when this
178 // register is being used for the scratch wave offset and there
179 // are no other free SGPRs, then the value will stay in this register.
180 // ----
181 // 13
182 for (MCPhysReg Reg : getAllSGPRs().drop_back(13).slice(NumPreloaded)) {
171183 // Pick the first unallocated SGPR. Be careful not to pick an alias of the
172184 // scratch descriptor, since we haven’t added its uses yet.
173185 if (!MRI.isPhysRegUsed(Reg)) {