Skip to content

Commit 930315f

Browse files
committed
[AMDGPU] Fix isSGPRReg for special registers
Special registers, e.g. MODE, do not have register classes so will cause null pointer exception if passed to isSGPRReg. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D134025
1 parent ad2449f commit 930315f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2696,7 +2696,7 @@ bool SIRegisterInfo::isSGPRReg(const MachineRegisterInfo &MRI,
26962696
RC = MRI.getRegClass(Reg);
26972697
else
26982698
RC = getPhysRegClass(Reg);
2699-
return isSGPRClass(RC);
2699+
return RC ? isSGPRClass(RC) : false;
27002700
}
27012701

27022702
const TargetRegisterClass *

0 commit comments

Comments
 (0)