Previously, LiveRegUnits was assuming that if a block has no successors
and does not return, then no registers are live at the end of it
(because the end of the block is unreachable). This was causing the
register scavenger to use callee-saved registers to materialise stack
frame addresses without saving them in the prologue. This would normally
be fine, because the end of the block is unreachable, but this is not
legal if the block ends by throwing a C++ exception. If this happens,
the scratch register will be modified, but its previous value won't be
preserved, so it doesn't get restored by the exception unwinder.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
LivePhysRegs had some related issues; see https://reviews.llvm.org/D42655 (and related discussion on https://reviews.llvm.org/D42509, which was reverted). Can we structure this code the same way?
lib/CodeGen/LiveRegUnits.cpp | ||
---|---|---|
128 ↗ | (On Diff #184078) | Please restructure this so we aren't checking succ_empty(); that check will cause wrong results in general. |
lib/CodeGen/LiveRegUnits.cpp | ||
---|---|---|
136 ↗ | (On Diff #184257) | Looks like this comment fell out of date? |