[llvm] CodeGen: Eliminate dynamic relocations in the register superclass tables. (PR #119122)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 11 03:55:56 PST 2024


================
@@ -123,7 +123,8 @@ X86RegisterInfo::getLargestLegalSuperClass(const TargetRegisterClass *RC,
   const X86Subtarget &Subtarget = MF.getSubtarget<X86Subtarget>();
 
   const TargetRegisterClass *Super = RC;
-  TargetRegisterClass::sc_iterator I = RC->getSuperClasses();
+  auto I = RC->superclasses().begin();
----------------
jayfoad wrote:

I think this code is really trying to iterate over RC and all its (proper) superclasses, so maybe it could be rewritten like:
```
  for (auto ID : concat<unsigned>({RC->getID()}, RC->superclasses()))
```

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


More information about the llvm-commits mailing list