[PATCH] D57381: [CodeGen] Don't scavenge non-saved regs in exception throwing functions

Oliver Stannard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 29 06:17:44 PST 2019


olista01 created this revision.
olista01 added reviewers: MatzeB, eli.friedman, dmgreen.
Herald added a subscriber: javed.absar.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D57381

Files:
  lib/CodeGen/LiveRegUnits.cpp
  test/CodeGen/ARM/register-scavenger-exceptions.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57381.184073.patch
Type: text/x-patch
Size: 4832 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190129/482ed0dd/attachment.bin>


More information about the llvm-commits mailing list