[llvm] [RISCV][WIP] Let RA do the CSR saves. (PR #90819)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 14:16:33 PST 2024


================
@@ -262,15 +262,21 @@ namespace {
     void HoistOutOfLoop(MachineDomTreeNode *HeaderN, MachineLoop *CurLoop,
                         MachineBasicBlock *CurPreheader);
 
-    void InitRegPressure(MachineBasicBlock *BB);
+    void InitRegPressure(MachineBasicBlock *BB, const MachineLoop *Loop);
----------------
michaelmaitland wrote:

>From the [original shrink wrapping paper](https://www.cs.tufts.edu/~nr/cs257/archive/fred-chow/p85-chow.pdf):

> There is one more consideration in performing the above shrink-wrap optimization. If the shrink-wrapped region lies completely inside a loop, there will be serious performance impact: instead of saving and restoring once per invocation of the procedure, this is now repeated for each iteration of the loop. To prevent this from occurring, whenever a register is used inside a loop, we propagate its APP attribute throughout the entire region of the loop. Thus, any shrink-wrap is not allowed to penetrate loop boundaries. 

I'm not sure I fully understand what's going on here but I wanted to check and see if this patch allows shrink wrapping on a per register basis inside loops. If so, is this something we should avoid? Is this concept at all related to this code?

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


More information about the llvm-commits mailing list