[PATCH] D20526: Soften assertion in AMDGPU emitPrologue.

Nirav Dave via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 09:09:27 PDT 2016

niravd created this revision.
niravd added reviewers: arsenm, tstellarAMD, nhaehnle.
niravd added a subscriber: llvm-commits.
Herald added subscribers: kzhuravl, arsenm.

[AMDGPU] emitPrologue looks for an unused unallocated SGPR that is not
the scratch descriptor. Continue search if unused register found fails
other requirements.

This resolves the final test failures holding up the Consecutive Store
Merge cleanup (D14834).



Index: lib/Target/AMDGPU/SIFrameLowering.cpp
--- lib/Target/AMDGPU/SIFrameLowering.cpp
+++ lib/Target/AMDGPU/SIFrameLowering.cpp
@@ -184,8 +184,9 @@
         // 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)) {
-          assert(MRI.isAllocatable(Reg) &&
-                !TRI->isSubRegisterEq(ScratchRsrcReg, Reg));
+          if (!MRI.isAllocatable(Reg) ||
+              TRI->isSubRegisterEq(ScratchRsrcReg, Reg))
+            continue;
           MRI.replaceRegWith(ScratchWaveOffsetReg, Reg);
           ScratchWaveOffsetReg = Reg;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20526.58104.patch
Type: text/x-patch
Size: 740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160523/ef364c2b/attachment.bin>

More information about the llvm-commits mailing list