-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid emitting unreachable SP adjustments after
throw
In 172eee9, we tried to avoid these by modelling the callee as internally resetting the stack pointer. However, for the majority of functions with reserved stack frames, this would lead LLVM to emit extra SP adjustments to undo the callee's internal adjustment. This lead us to fix the problem further on down the pipeline in eliminateCallFramePseudoInstr. In 5b79e60, I added use a heuristic to try to detect when the adjustment would be unreachable. This heuristic is imperfect, and when exception handling is involved, it fails to fire. The new test is an example of this. Simply throwing an exception with an active cleanup emits dead SP adjustments after the throw. Not only are they dead, but if they were executed, they would be incorrect, so they are confusing. This change essentially reverts 172eee9 and makes the 5b79e60 heuristic responsible for preventing unreachable stack adjustments. This means we may emit unreachable stack adjustments for functions using EH with unreserved call frames, but that is not very many these days. Back in 2016 when this change was added, we were focused on 32-bit, which we observed to have fewer reserved frames. Fixes PR45064 Reviewed By: hans Differential Revision: https://reviews.llvm.org/D75712
- Loading branch information
Showing
3 changed files
with
65 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters