[PATCH] [WinEH] Handle the case of nested landing pads that return to a block in the parent function.

Andy Kaylor andrew.kaylor at intel.com
Mon May 11 15:16:42 PDT 2015


Hi rnk, majnemer,

This adds support for preserving the correct control flow representation in the case where a nested landing pad returns to a block in the parent function.  This can happen, for instance, in a case where the landing pad in question originally enclosed the handler in which it is nested in the user's source code but can only be reached from the enclosed landing pad.  The following code is an example:
```
void test1() {
  try {
    try {
      throw 1;
    } catch(...) { throw; }
  } catch (...) { }
}
```
In such a case, we must represent the block to which the "nested" landing pad returns as a possible target of the landing pad in which it is enclosed in order to prevent the target block from being eliminated as dead code.

This patch only handles to case described at the WinEHPrepare level.  There are still problem executing a program which includes the case above, but I can reproduce the same failures without the scenario that this patch is meant to address.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9684

Files:
  lib/CodeGen/WinEHPrepare.cpp
  test/CodeGen/WinEH/cppeh-catch-unwind.ll
  test/CodeGen/WinEH/cppeh-nested-1.ll
  test/CodeGen/WinEH/cppeh-nested-2.ll
  test/CodeGen/WinEH/cppeh-nested-3.ll
  test/CodeGen/WinEH/cppeh-nested-rethrow.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9684.25517.patch
Type: text/x-patch
Size: 19798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150511/5c30779e/attachment.bin>


More information about the llvm-commits mailing list