[llvm] [CodeGen] De-type getMinimalPhysRegClass and related APIs (PR #197495)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 05:45:30 PDT 2026


================
@@ -99,6 +99,16 @@ namespace {
 /// at one time.
 static ManagedStatic<sys::SmartMutex<true>> ReportedErrorsLock;
 
+static bool hasPhysRegClassForType(const TargetRegisterInfo &TRI,
+                                   MCRegister Reg, LLT Ty) {
+  assert(Reg.isPhysical() && "reg must be a physical register");
+  assert(Ty.isValid() && "expected a valid type");
+
+  return llvm::any_of(TRI.regclasses(), [&](const TargetRegisterClass *RC) {
----------------
sdesmalen-arm wrote:

nit: is it worth trying the regclass resulting from `TRI->getMinimalPhysRegClass(Reg)` first before iterating over all over reg classes?

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


More information about the llvm-commits mailing list