[all-commits] [llvm/llvm-project] 65b212: Avoid emitting unreachable SP adjustments after `t...
Reid Kleckner via All-commits
all-commits at lists.llvm.org
Fri Mar 6 13:33:49 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 65b21282c710afe9c275778820c6e3c1cf46734b
https://github.com/llvm/llvm-project/commit/65b21282c710afe9c275778820c6e3c1cf46734b
Author: Reid Kleckner <rnk at google.com>
Date: 2020-03-06 (Fri, 06 Mar 2020)
Changed paths:
M llvm/lib/Target/X86/X86FrameLowering.cpp
M llvm/lib/Target/X86/X86ISelLowering.cpp
M llvm/test/CodeGen/X86/noreturn-call-win64.ll
Log Message:
-----------
Avoid emitting unreachable SP adjustments after `throw`
In 172eee9c, 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 5b79e603d3b7a2994, 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 172eee9c and makes the 5b79e603d3b7a2994
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
More information about the All-commits
mailing list