[PATCH] D16763: [X86] Optimize WinEH state stores

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 31 21:33:48 PST 2016


majnemer created this revision.
majnemer added a reviewer: rnk.
majnemer added a subscriber: llvm-commits.

32-bit x86 Windows targets use a linked-list of nodes allocated on the
stack, referenced to via thread-local storage.  The personality routine
interprets one of the fields in the node as a 'state number' which
indicates where the personality routine should transfer control.

State transitions are possible only before call-sites which may throw
exceptions.  Our previous scheme had us update the state number before
all call-sites which may throw.

Instead, we can try to minimize the number of times we need to store by
reasoning about the nearest store which dominates the current call-site.
If the last store agrees with the current call-site, then we know that
the state-update is redundant and can be elided.

This is largely straightforward: a RPO walk of the blocks allows us to
correctly forward propagate the information when the function is a DAG.
Currently, loops are not handled optimally and may trigger superfluous
state stores.

http://reviews.llvm.org/D16763

Files:
  lib/Target/X86/X86WinEHState.cpp
  test/CodeGen/WinEH/wineh-statenumbering.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16763.46508.patch
Type: text/x-patch
Size: 11318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160201/0c6dc782/attachment.bin>


More information about the llvm-commits mailing list