This is an archive of the discontinued LLVM Phabricator instance.

[WinEH] C++ EH state number fixes
ClosedPublic

Authored by andrew.w.kaylor on May 14 2015, 7:16 PM.

Details

Summary

This patch fixes a number of problems with EH state numbering for C++ exception handling on Windows. I believe all of the problems addressed here are related to nested landing pads.

  • When a handler appeared, then was masked by another handler, then reappeared, two states were created, the base state of the handler was changed (making it out of sync with any states it enclosed) and two non-contiguous try map entries were created for the handler (the runtime doesn't seem to like that).
  • When a nested handler should have returned to a block in another handler and that block was otherwise unreachable, it was being incorrectly pruned from the handler.
  • When a nested landing pad pushed handlers on the stack that were not used outside that landing pad, they were not being correctly processed and in some cases were not processed at all.

Diff Detail

Repository
rL LLVM

Event Timeline

andrew.w.kaylor retitled this revision from to [WinEH] C++ EH state number fixes.
andrew.w.kaylor updated this object.
andrew.w.kaylor edited the test plan for this revision. (Show Details)
andrew.w.kaylor added reviewers: rnk, majnemer.
andrew.w.kaylor set the repository for this revision to rL LLVM.
andrew.w.kaylor added a subscriber: Unknown Object (MLST).
rnk accepted this revision.May 19 2015, 5:42 PM
rnk edited edge metadata.

lgtm

lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
394–396 ↗(On Diff #25839)

This might cover invokes in a state outside the try if block placement makes it so. Probably worth a comment that this isn't always a correct change.

lib/CodeGen/WinEHPrepare.cpp
221 ↗(On Diff #25839)

Missing the 'c' in Indirect

This revision is now accepted and ready to land.May 19 2015, 5:42 PM
This revision was automatically updated to reflect the committed changes.