[llvm] [Draft] Support save/restore point splitting in shrink-wrap (PR #119359)
Elizaveta Noskova via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 2 09:06:02 PST 2025
enoskova-sc wrote:
@asb, thank you for reviewing my patch and for highlighting the issues you observed!
I’ve addressed the problems in my shrink-wrap implementation that caused the behavior you saw in your reduced examples.
Regarding the SPEC failures—you mentioned—I’ll work on reproducing and analyzing them as well.
As for the performance results you’re seeing: I confirm they’re expected. The current implementation falls back to the simple (non-split) shrink-wrap mode whenever a frame adjustment instruction is encountered ([see code](https://github.com/llvm/llvm-project/blob/3e23566edd397a4b5a956252722c22d67a1e4b77/llvm/lib/CodeGen/ShrinkWrap.cpp#L1122)).
This means that for functions containing calls (which introduce frame adjustments), shrink-wrap splitting is disabled. The reason for this conservative approach is that functions may use _builtin_alloca, which gets lowered to a frame adjustment instruction, which can happen in the middle of the function and break algorithm assumptions.
At the moment, I haven’t found a reliable way to detect _builtin_alloca other than checking for the presence of frame adjustment instructions.
I'll prepare an example with _builtin_alloca and post it tomorrow for clarification.
https://github.com/llvm/llvm-project/pull/119359
More information about the llvm-commits
mailing list