[llvm] [Draft] Support save/restore point splitting in shrink-wrap (PR #119359)
Elizaveta Noskova via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 20 03:55:02 PDT 2026
enoskova-sc wrote:
While searching for ways to improve the current algorithm, I discovered the old ShrinkWrappingPass, which was removed from LLVM a long time ago (removing commit hash dbec9d9b2a6ce38d21e3ab2a60b0252d51f4d384). It was based on Fred C. Chow's PLDI '88 paper and implemented a data-flow approach but was overly conservative. Specifically, when the optimal placement for save/restore instructions was on an edge, the pass avoided splitting the edge and instead placed the instructions in a suboptimal basic block.
I decided to revive this approach and combine it with edge splitting. For the first iteration, I simulated edge splitting by constructing an auxiliary CFG for data-flow calculations, inserting a new empty block on each edge. After calculating the optimal save/restore locations, if a point fell within one of these new blocks, I split the actual CFG edges and inserted the instructions there.
So far, I have measured instruction count improvements only on Blender (train), achieving a 2.8% reduction in runtime instruction count. I plan to post the patch in a couple of days.
@asb, @preames FYI.
https://github.com/llvm/llvm-project/pull/119359
More information about the llvm-commits
mailing list