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

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 20:04:31 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:

It seems we may mix scalar/RVV/varsize/... objects here? I don't know if we should keep the arrangement of these categories and sort the objects inside.

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


More information about the llvm-commits mailing list