[PATCH] D134025: [AMDGPU] Fix isSGPRReg for special registers

Carl Ritson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 16 01:36:54 PDT 2022


critson created this revision.
critson added reviewers: foad, arsenm.
Herald added subscribers: kosarev, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: All.
critson requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Special registers, e.g. MODE, do not have register classes so
will cause null pointer exception if passed to isSGPRReg.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134025

Files:
  llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp


Index: llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
@@ -2696,7 +2696,7 @@
     RC = MRI.getRegClass(Reg);
   else
     RC = getPhysRegClass(Reg);
-  return isSGPRClass(RC);
+  return RC ? isSGPRClass(RC) : false;
 }
 
 const TargetRegisterClass *


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134025.460671.patch
Type: text/x-patch
Size: 404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220916/caaf924c/attachment.bin>


More information about the llvm-commits mailing list