[PATCH] D158623: [RISCV] Reorder the stack frame objects.

lcvon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 01:23:27 PDT 2023


lcvon007 added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:491
+  const RISCVRegisterInfo *RI = STI.getRegisterInfo();
+  // It's only used to reduce codesize.
+  if (!MF.getFunction().hasOptSize())
----------------
reames wrote:
> I don't think this should be conditional on size optimization.  Using compressed loads and stores for frequently accessed objects should improve performance or at least be neutral.  
yes, I think it may improve the performance in much scenario, but it may regress the performance because we use static use number of object but not the runtime information.   For example,
The original order of frame objects is : A,  B (A is in base+ offset addressable range and B is not).
The final order after sorting is: B,  A( B is in range but A is not)
and the running number of A is much more than B, so it may regress the performance in theory.

So is it ok to put this optimization under normal compiling mode? @reames 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158623/new/

https://reviews.llvm.org/D158623



More information about the llvm-commits mailing list