[llvm] [RISCV] Order stack objects by access density (PR #217507)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 02:40:59 PDT 2026


================
@@ -2846,6 +2848,75 @@ void RISCVFrameLowering::inlineStackProbe(MachineFunction &MF,
   }
 }
 
+namespace {
+/// Bookkeeping record used while ordering local stack objects by access
+/// density. One record is created for each frame index passed to
+/// orderFrameObjects().
+struct RISCVFrameSortingObject {
+  int ObjectIndex;
+  uint64_t ObjectSize;
+  Align ObjectAlign;
+  uint64_t NumUses = 0;
+};
+} // end anonymous namespace
+
+void RISCVFrameLowering::orderFrameObjects(
----------------
wangpc-pp wrote:

Thanks for the explanation! Then the question is, would it be beneficial to sort RVV objects as well?

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


More information about the llvm-commits mailing list