[llvm] [StackMaps] Check both subregs and superregs for getDwarfRegNum (PR #95837)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 02:50:33 PDT 2024


================
@@ -191,14 +191,22 @@ unsigned StackMaps::getNextMetaArgIdx(const MachineInstr *MI, unsigned CurIdx) {
   return CurIdx;
 }
 
-/// Go up the super-register chain until we hit a valid dwarf register number.
+/// Go up the super-register and sub-register chain until we hit a valid dwarf
+/// register number.
 static unsigned getDwarfRegNum(unsigned Reg, const TargetRegisterInfo *TRI) {
   int RegNum;
   for (MCPhysReg SR : TRI->superregs_inclusive(Reg)) {
     RegNum = TRI->getDwarfRegNum(SR, false);
     if (RegNum >= 0)
       break;
   }
+  if (RegNum < 0) {
----------------
arsenm wrote:

Definitely should try to just use the MCRegisterInfo version instead of reconstructing it. 


> Do we really need the DwarfRegAlias in td files? 

I don't know, but the rest of your comment implies to me it only works if you can't address all parts of the register. e.g. if you have sub0_sub1, a direct sub1 use should not have the same number as sub0_sub1 (but maybe sub0 could have the same as sub0_sub1)? I haven't really looked at subregisters in dwarf before 

https://github.com/llvm/llvm-project/pull/95837


More information about the llvm-commits mailing list