Add -experimental-shrink-wrapping flag to control when we
want to move callee-saved registers even when addresses of the stack
frame are captured and used in pointer arithmetic, making it more
challenging to do alias analysis to prove that we do not access
optimized stack positions. This alias analysis is not yet implemented,
hence, it is experimental. In practice, though, no compiler would emit
code to do pointer arithmetic to access a saved callee-saved register
unless there is a memory bug or we are failing to identify a
callee-saved reg, so I'm not sure how useful it would be to formally
prove that.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
To recap:
- This diff adds a new experimental shrink wrapping mode which ignores escaping stack pointer (ie. mov rsp -> reg) in moving callee-saved registers.
- This is based on the assumption that stack frame locations for CSRs are not explicitly addressed by the function code.
- For functions that have been optimized under this mode, the new property (FAA.doesEscapeStackAddress) is added to prevent further Frame optimizations.