[llvm] [RegAlloc] Add register allocation anti-hints infrastructure (PR #218071)

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 21:48:02 PDT 2026


================
@@ -85,16 +94,26 @@ class LLVM_LIBRARY_VISIBILITY AllocationOrder {
                                 const RegisterClassInfo &RegClassInfo,
                                 const LiveRegMatrix *Matrix);
 
+  /// Create an AllocationOrder from HintsAndCustomOrder that contains NumHints
+  /// Hints optionally followed by a reordered Order. If no reordered copy is
+  /// present use Order as-is.
+  AllocationOrder(SmallVector<MCPhysReg, 16> &&HintsAndCustomOrder,
+                  int NumHints, ArrayRef<MCPhysReg> Order, bool HardHints)
+      : HintsAndCustomOrder(std::move(HintsAndCustomOrder)), NumHints(NumHints),
+        Order(static_cast<int>(this->HintsAndCustomOrder.size()) > NumHints
+                  ? ArrayRef<MCPhysReg>(this->HintsAndCustomOrder)
+                        .drop_front(NumHints)
----------------
qcolombet wrote:

I'm puzzled by the logic here. Do we expect HintsAndCustomOrder to fully contains Order when HintsAndCustomOrder is larger than NumHints?

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


More information about the llvm-commits mailing list