diff --git a/llvm/utils/TableGen/CodeGenRegisters.cpp b/llvm/utils/TableGen/CodeGenRegisters.cpp --- a/llvm/utils/TableGen/CodeGenRegisters.cpp +++ b/llvm/utils/TableGen/CodeGenRegisters.cpp @@ -834,6 +834,12 @@ VTs = Super.VTs; CopyCost = Super.CopyCost; Allocatable = Super.Allocatable; + if (!Allocatable) { + // Check for allocatable superclasses. + for (auto S = SuperClasses.rbegin(); + S != SuperClasses.rend() && !Allocatable; ++S) + Allocatable |= (*S)->Allocatable; + } AltOrderSelect = Super.AltOrderSelect; AllocationPriority = Super.AllocationPriority; GeneratePressureSet |= Super.GeneratePressureSet;