[llvm] [X86][BreakFalseDeps] Using reverse order for undef register selection (PR #137569)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 01:03:32 PDT 2025


================
@@ -142,7 +144,12 @@ void RegisterClassInfo::compute(const TargetRegisterClass *RC) const {
 
   // FIXME: Once targets reserve registers instead of removing them from the
   // allocation order, we can simply use begin/end here.
-  ArrayRef<MCPhysReg> RawOrder = RC->getRawAllocationOrder(*MF);
+  ArrayRef<MCPhysReg> RawOrder = RC->getRawAllocationOrder(*MF, Reverse);
+  std::vector<MCPhysReg> ReverseOrder;
+  if (Reverse) {
+    llvm::append_range(ReverseOrder, reverse(RawOrder));
+    RawOrder = ArrayRef<MCPhysReg>(ReverseOrder);
+  }
----------------
arsenm wrote:

What's wrong with it being a target faster? Could also expand the alternative allocation order controls. This is hardcoding a single alternative choice and requires a runtime sort 

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


More information about the llvm-commits mailing list