[llvm] r270646 - Soften assertion in AMDGPU emitPrologue.

Nirav Dave via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 18:45:43 PDT 2016

Author: niravd
Date: Tue May 24 20:45:42 2016
New Revision: 270646

URL: http://llvm.org/viewvc/llvm-project?rev=270646&view=rev
Soften assertion in AMDGPU emitPrologue.

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

Reviewers: arsenm, tstellarAMD, nhaehnle

Subscribers: arsenm, llvm-commits, kzhuravl

Differential Revision: http://reviews.llvm.org/D20526


Modified: llvm/trunk/lib/Target/AMDGPU/SIFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIFrameLowering.cpp?rev=270646&r1=270645&r2=270646&view=diff
--- llvm/trunk/lib/Target/AMDGPU/SIFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIFrameLowering.cpp Tue May 24 20:45:42 2016
@@ -184,8 +184,9 @@ void SIFrameLowering::emitPrologue(Machi
         // 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;

More information about the llvm-commits mailing list