<div dir="ltr">Fixed in r237906<br></div><br><div class="gmail_quote">On Thu, May 21, 2015 at 5:24 PM Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote">On Thu, May 21, 2015 at 1:28 AM Andrew Kaylor <<a href="mailto:andrew.kaylor@intel.com" target="_blank">andrew.kaylor@intel.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: akaylor<br>
Date: Wed May 20 18:22:24 2015<br>
New Revision: 237854<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D237854-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=FQjS7sJFHjqq1VVoTFnx0GeYuZgRudIlT5kCrScFIxw&s=iWr5zcrsE6gzJYc042xGVvvdn1mjbOu4ww85rUR18_U&e=" target="_blank">http://llvm.org/viewvc/llvm-project?rev=237854&view=rev</a><br>
Log:<br>
[WinEH] C++ EH state numbering fixes<br>
<br>
Differential Revision: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D9787&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=FQjS7sJFHjqq1VVoTFnx0GeYuZgRudIlT5kCrScFIxw&s=6gFpHY_wnV_S8Wd5sNvFZICiUn-BNMNR-8YmoKkzMEs&e=" target="_blank">http://reviews.llvm.org/D9787</a><br>
<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/CodeGen/WinEHFuncInfo.h<br>
    llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp<br>
    llvm/trunk/lib/CodeGen/WinEHPrepare.cpp<br>
    llvm/trunk/test/CodeGen/WinEH/cppeh-nested-1.ll<br>
    llvm/trunk/test/CodeGen/WinEH/cppeh-nested-2.ll<br>
    llvm/trunk/test/CodeGen/WinEH/cppeh-nested-3.ll<br>
    llvm/trunk/test/CodeGen/WinEH/cppeh-nested-rethrow.ll<br>
    llvm/trunk/test/CodeGen/WinEH/cppeh-similar-catch-blocks.ll<br>
    llvm/trunk/test/CodeGen/WinEH/cppeh-state-calc-1.ll<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/WinEHFuncInfo.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_CodeGen_WinEHFuncInfo.h-3Frev-3D237854-26r1-3D237853-26r2-3D237854-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=FQjS7sJFHjqq1VVoTFnx0GeYuZgRudIlT5kCrScFIxw&s=sM77kKkAYRG4vG8FimsCbyo-hP2KyYRnTP7GjrxwUNU&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/WinEHFuncInfo.h?rev=237854&r1=237853&r2=237854&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/WinEHFuncInfo.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/WinEHFuncInfo.h Wed May 20 18:22:24 2015<br>
@@ -131,6 +131,10 @@ struct WinEHTryBlockMapEntry {<br>
 };<br>
<br>
 struct WinEHFuncInfo {<br>
+  DenseMap<const Function *, const LandingPadInst *> RootLPad;<br>
+  DenseMap<const Function *, const InvokeInst *> LastInvoke;<br>
+  DenseMap<const Function *, int> HandlerEnclosedState;<br>
+  DenseMap<const Function *, bool> LastInvokeVisited;<br>
   DenseMap<const LandingPadInst *, int> LandingPadStateMap;<br>
   DenseMap<const Function *, int> CatchHandlerParentFrameObjIdx;<br>
   DenseMap<const Function *, int> CatchHandlerParentFrameObjOffset;<br>
<br>
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_SelectionDAG_FunctionLoweringInfo.cpp-3Frev-3D237854-26r1-3D237853-26r2-3D237854-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=FQjS7sJFHjqq1VVoTFnx0GeYuZgRudIlT5kCrScFIxw&s=fqdNWgeIzvKUpByZ4Nd1NDhbfgMj8Hr7m9OMJgOornA&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=237854&r1=237853&r2=237854&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Wed May 20 18:22:24 2015<br>
@@ -101,7 +101,9 @@ struct WinEHNumbering {<br>
                               ArrayRef<CatchHandler *> Handlers);<br>
   void processCallSite(MutableArrayRef<std::unique_ptr<ActionHandler>> Actions,<br>
                        ImmutableCallSite CS);<br>
+  void popUnmatchedActions(int FirstMismatch);<br>
   void calculateStateNumbers(const Function &F);<br>
+  void findActionRootLPads(const Function &F);<br>
 };<br>
 }<br>
<br>
@@ -297,9 +299,16 @@ void FunctionLoweringInfo::set(const Fun<br>
     EHInfo = &MMI.getWinEHFuncInfo(WinEHParentFn);<br>
     if (EHInfo->LandingPadStateMap.empty()) {<br>
       WinEHNumbering Num(*EHInfo);<br>
+      Num.findActionRootLPads(*WinEHParentFn);<br>
+      // The VisitedHandlers list is used by both findActionRootLPads and<br>
+      // calculateStateNumbers, but both functions need to visit all handlers.<br>
+      Num.VisitedHandlers.clear();<br>
       Num.calculateStateNumbers(*WinEHParentFn);<br>
       // Pop everything on the handler stack.<br>
-      Num.processCallSite(None, ImmutableCallSite());<br>
+      // It may be necessary to call this more than once because a handler can<br>
+      // be pushed on the stack as a result of clearing the stack.<br>
+      while (!Num.HandlerStack.empty())<br>
+        Num.processCallSite(None, ImmutableCallSite());<br>
     }<br>
<br>
     // Copy the state numbers to LandingPadInfo for the current function, which<br>
@@ -361,6 +370,45 @@ void WinEHNumbering::createUnwindMapEntr<br>
<br>
 void WinEHNumbering::createTryBlockMapEntry(int TryLow, int TryHigh,<br>
                                             ArrayRef<CatchHandler *> Handlers) {<br>
+  // See if we already have an entry for this set of handlers.<br>
+  // This is using iterators rather than a range-based for loop because<br>
+  // if we find the entry we're looking for we'll need the iterator to erase it.<br>
+  int NumHandlers = Handlers.size();<br>
+  auto I = FuncInfo.TryBlockMap.begin();<br>
+  auto E = FuncInfo.TryBlockMap.end();<br>
+  for ( ; I != E; ++I) {<br>
+    auto &Entry = *I;<br>
+    if (Entry.HandlerArray.size() != NumHandlers)<br>
+      continue;<br>
+    int N;<br>
+    for (N = 0; N < NumHandlers; ++N) {<br>
+      if (Entry.HandlerArray[N].Handler != Handlers[N]->getHandlerBlockOrFunc())<br>
+        break; // breaks out of inner loop<br>
+    }<br>
+    // If all the handlers match, this is what we were looking for.<br>
+    if (N == NumHandlers) {<br>
+      break;<br>
+    }<br>
+  }<br>
+<br>
+  // If we found an existing entry for this set of handlers, extend the range<br>
+  // but move the entry to the end of the map vector.  The order of entries<br>
+  // in the map is critical to the way that the runtime finds handlers.<br>
+  // FIXME: Depending on what has happened with block ordering, this may<br>
+  //        incorrectly combine entries that should remain separate.<br>
+  if (I != E) {<br>
+    // Copy the existing entry.<br>
+    WinEHTryBlockMapEntry Entry = *I;<br>
+    Entry.TryLow = std::min(TryLow, Entry.TryLow);<br>
+    Entry.TryHigh = std::max(TryHigh, Entry.TryHigh);<br>
+    assert(Entry.TryLow <= Entry.TryHigh);<br>
+    // Erase the old entry and add this one to the back.<br>
+    FuncInfo.TryBlockMap.erase(I);<br>
+    FuncInfo.TryBlockMap.push_back(Entry);<br>
+    return;<br>
+  }<br>
+<br>
+  // If we didn't find an entry, create a new one.<br>
   WinEHTryBlockMapEntry TBME;<br>
   TBME.TryLow = TryLow;<br>
   TBME.TryHigh = TryHigh;<br>
@@ -429,6 +477,65 @@ void WinEHNumbering::processCallSite(<br>
       break;<br>
   }<br>
<br>
+  // Remove unmatched actions from the stack and process their EH states.<br>
+  popUnmatchedActions(FirstMismatch);<br>
+<br>
+  DEBUG(dbgs() << "Pushing actions for CallSite: ");<br>
+  print_name(CS ? CS.getCalledValue() : nullptr);<br>
+  DEBUG(dbgs() << '\n');<br>
+<br>
+  bool LastActionWasCatch = false;<br>
+  const LandingPadInst *LastRootLPad = nullptr;<br>
+  for (size_t I = FirstMismatch; I != Actions.size(); ++I) {<br>
+    // We can reuse eh states when pushing two catches for the same invoke.<br>
+    bool CurrActionIsCatch = isa<CatchHandler>(Actions[I].get());<br>
+    auto *Handler = cast<Function>(Actions[I]->getHandlerBlockOrFunc());<br>
+    // Various conditions can lead to a handler being popped from the<br>
+    // stack and re-pushed later.  That shouldn't create a new state.<br>
+    // FIXME: Can code optimization lead to re-used handlers?<br>
+    if (FuncInfo.HandlerEnclosedState.count(Handler)) {<br>
+      // If we already assigned the state enclosed by this handler re-use it.<br>
+      Actions[I]->setEHState(FuncInfo.HandlerEnclosedState[Handler]);<br>
+      continue;<br>
+    }<br>
+    const LandingPadInst* RootLPad = FuncInfo.RootLPad[Handler];<br>
+    if (CurrActionIsCatch && LastActionWasCatch && RootLPad == LastRootLPad) {<br>
+      DEBUG(dbgs() << "setEHState for handler to " << currentEHNumber() << "\n");<br>
+      Actions[I]->setEHState(currentEHNumber());<br>
+    } else {<br>
+      DEBUG(dbgs() << "createUnwindMapEntry(" << currentEHNumber() << ", ");<br>
+      print_name(Actions[I]->getHandlerBlockOrFunc());<br>
+      DEBUG(dbgs() << ") with EH state " << NextState << "\n");<br>
+      createUnwindMapEntry(currentEHNumber(), Actions[I].get());<br>
+      DEBUG(dbgs() << "setEHState for handler to " << NextState << "\n");<br>
+      Actions[I]->setEHState(NextState);<br>
+      NextState++;<br>
+    }<br>
+    HandlerStack.push_back(std::move(Actions[I]));<br>
+    LastActionWasCatch = CurrActionIsCatch;<br>
+    LastRootLPad = RootLPad;<br>
+  }<br>
+<br>
+  // This is used to defer numbering states for a handler until after the<br>
+  // last time it appears in an invoke action list.<br>
+  if (CS.isInvoke()) {<br>
+    for (int I = 0, E = HandlerStack.size(); I < E; ++I) {<br>
+      auto *Handler = cast<Function>(HandlerStack[I]->getHandlerBlockOrFunc());<br>
+      if (FuncInfo.LastInvoke[Handler] != cast<InvokeInst>(CS.getInstruction()))<br>
+        continue;<br>
+      FuncInfo.LastInvokeVisited[Handler] = true;<br>
+      DEBUG(dbgs() << "Last invoke of ");<br>
+      print_name(Handler);<br>
+      DEBUG(dbgs() << " has been visited.\n");<br>
+    }<br>
+  }<br>
+<br>
+  DEBUG(dbgs() << "In EHState " << currentEHNumber() << " for CallSite: ");<br>
+  print_name(CS ? CS.getCalledValue() : nullptr);<br>
+  DEBUG(dbgs() << '\n');<br>
+}<br>
+<br>
+void WinEHNumbering::popUnmatchedActions(int FirstMismatch) {<br>
   // Don't recurse while we are looping over the handler stack.  Instead, defer<br>
   // the numbering of the catch handlers until we are done popping.<br>
   SmallVector<CatchHandler *, 4> PoppedCatches;<br>
@@ -460,60 +567,25 @@ void WinEHNumbering::processCallSite(<br>
<br>
   for (CatchHandler *CH : PoppedCatches) {<br>
     if (auto *F = dyn_cast<Function>(CH->getHandlerBlockOrFunc())) {<br>
-      DEBUG(dbgs() << "Assigning base state " << NextState << " to ");<br>
-      print_name(F);<br>
-      DEBUG(dbgs() << '\n');<br>
-      FuncInfo.HandlerBaseState[F] = NextState;<br>
-      DEBUG(dbgs() << "createUnwindMapEntry(" << currentEHNumber()<br>
-                   << ", null)\n");<br>
-      createUnwindMapEntry(currentEHNumber(), nullptr);<br>
-      ++NextState;<br>
-      calculateStateNumbers(*F);<br>
+      if (FuncInfo.LastInvokeVisited[F]) {<br>
+        DEBUG(dbgs() << "Assigning base state " << NextState << " to ");<br>
+        print_name(F);<br>
+        DEBUG(dbgs() << '\n');<br>
+        FuncInfo.HandlerBaseState[F] = NextState;<br>
+        DEBUG(dbgs() << "createUnwindMapEntry(" << currentEHNumber()<br>
+                     << ", null)\n");<br>
+        createUnwindMapEntry(currentEHNumber(), nullptr);<br>
+        ++NextState;<br>
+        calculateStateNumbers(*F);<br>
+      }<br>
+      else {<br>
+        DEBUG(dbgs() << "Deferring handling of ");<br>
+        print_name(F);<br>
+        DEBUG(dbgs() << " until last invoke visited.\n");<br>
+      }<br>
     }<br>
     delete CH;<br>
   }<br>
-<br>
-  // The handler functions may have pushed actions onto the handler stack<br>
-  // that we expected to push here.  Compare the handler stack to our<br>
-  // actions again to check for that possibility.<br>
-  if (HandlerStack.size() > (size_t)FirstMismatch) {<br>
-    for (int E = std::min(HandlerStack.size(), Actions.size());<br>
-         FirstMismatch < E; ++FirstMismatch) {<br>
-      if (HandlerStack[FirstMismatch]->getHandlerBlockOrFunc() !=<br>
-          Actions[FirstMismatch]->getHandlerBlockOrFunc())<br>
-        break;<br>
-    }<br>
-  }<br>
-<br>
-  DEBUG(dbgs() << "Pushing actions for CallSite: ");<br>
-  print_name(CS ? CS.getCalledValue() : nullptr);<br>
-  DEBUG(dbgs() << '\n');<br>
-<br>
-  bool LastActionWasCatch = false;<br>
-  for (size_t I = FirstMismatch; I != Actions.size(); ++I) {<br>
-    // We can reuse eh states when pushing two catches for the same invoke.<br>
-    bool CurrActionIsCatch = isa<CatchHandler>(Actions[I].get());<br>
-    // FIXME: Reenable this optimization!<br>
-    if (CurrActionIsCatch && LastActionWasCatch && false) {<br>
-      DEBUG(dbgs() << "setEHState for handler to " << currentEHNumber()<br>
-                   << "\n");<br>
-      Actions[I]->setEHState(currentEHNumber());<br>
-    } else {<br>
-      DEBUG(dbgs() << "createUnwindMapEntry(" << currentEHNumber() << ", ");<br>
-      print_name(Actions[I]->getHandlerBlockOrFunc());<br>
-      DEBUG(dbgs() << ")\n");<br>
-      createUnwindMapEntry(currentEHNumber(), Actions[I].get());<br>
-      DEBUG(dbgs() << "setEHState for handler to " << NextState << "\n");<br>
-      Actions[I]->setEHState(NextState);<br>
-      NextState++;<br>
-    }<br>
-    HandlerStack.push_back(std::move(Actions[I]));<br>
-    LastActionWasCatch = CurrActionIsCatch;<br>
-  }<br>
-<br>
-  DEBUG(dbgs() << "In EHState " << currentEHNumber() << " for CallSite: ");<br>
-  print_name(CS ? CS.getCalledValue() : nullptr);<br>
-  DEBUG(dbgs() << '\n');<br>
 }<br>
<br>
 void WinEHNumbering::calculateStateNumbers(const Function &F) {<br>
@@ -526,6 +598,8 @@ void WinEHNumbering::calculateStateNumbe<br>
     CurrentBaseState = FuncInfo.HandlerBaseState[&F];<br>
   }<br>
<br>
+  size_t SavedHandlerStackSize = HandlerStack.size();<br>
+<br>
   DEBUG(dbgs() << "Calculating state numbers for: " << F.getName() << '\n');<br>
   SmallVector<std::unique_ptr<ActionHandler>, 4> ActionList;<br>
   for (const BasicBlock &BB : F) {<br>
@@ -554,11 +628,64 @@ void WinEHNumbering::calculateStateNumbe<br>
                   << '\n');<br>
   }<br>
<br>
+  // Pop any actions that were pushed on the stack for this function.<br>
+  popUnmatchedActions(SavedHandlerStackSize);<br>
+<br>
+  DEBUG(dbgs() << "Assigning max state " << NextState - 1<br>
+               << " to " << F.getName() << '\n');<br>
   FuncInfo.CatchHandlerMaxState[&F] = NextState - 1;<br>
<br>
   CurrentBaseState = OldBaseState;<br>
 }<br>
<br>
+// This function follows the same basic traversal as calculateStateNumbers<br>
+// but it is necessary to identify the root landing pad associated<br>
+// with each action before we start assigning state numbers.<br>
+void WinEHNumbering::findActionRootLPads(const Function &F) {<br>
+  auto I = VisitedHandlers.insert(&F);<br>
+  if (!I.second)<br>
+    return; // We've already visited this handler, don't revisit it.<br>
+<br>
+  SmallVector<std::unique_ptr<ActionHandler>, 4> ActionList;<br>
+  for (const BasicBlock &BB : F) {<br>
+    const auto *II = dyn_cast<InvokeInst>(BB.getTerminator());<br>
+    if (!II)<br>
+      continue;<br>
+    const LandingPadInst *LPI = II->getLandingPadInst();<br>
+    auto *ActionsCall = dyn_cast<IntrinsicInst>(LPI->getNextNode());<br>
+    if (!ActionsCall)<br>
+      continue;<br>
+<br>
+    assert(ActionsCall->getIntrinsicID() == Intrinsic::eh_actions);<br>
+    parseEHActions(ActionsCall, ActionList);<br>
+    if (ActionList.empty())<br>
+      continue;<br>
+    for (int I = 0, E = ActionList.size(); I < E; ++I) {<br>
+      if (auto *Handler<br>
+              = dyn_cast<Function>(ActionList[I]->getHandlerBlockOrFunc())) {<br>
+        FuncInfo.LastInvoke[Handler] = II;<br>
+        // Don't replace the root landing pad if we previously saw this<br>
+        // handler in a different function.<br>
+        if (FuncInfo.RootLPad.count(Handler) &&<br>
+            FuncInfo.RootLPad[Handler]->getParent()->getParent() != &F)<br>
+          continue;<br>
+        DEBUG(dbgs() << "Setting root lpad for ");<br>
+        print_name(Handler);<br>
+        DEBUG(dbgs() << " to " << LPI->getParent()->getName() << '\n');<br>
+        FuncInfo.RootLPad[Handler] = LPI;<br>
+      }<br>
+    }<br>
+    // Walk the actions again and look for nested handlers.  This has to<br>
+    // happen after all of the actions have been processed in the current<br>
+    // function.<br>
+    for (int I = 0, E = ActionList.size(); I < E; ++I)<br>
+      if (auto *Handler<br>
+              = dyn_cast<Function>(ActionList[I]->getHandlerBlockOrFunc()))<br>
+        findActionRootLPads(*Handler);<br>
+    ActionList.clear();<br>
+  }<br>
+}<br>
+<br>
 /// clear - Clear out all the function-specific state. This returns this<br>
 /// FunctionLoweringInfo to an empty state, ready to be used for a<br>
 /// different function.<br>
<br>
Modified: llvm/trunk/lib/CodeGen/WinEHPrepare.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_WinEHPrepare.cpp-3Frev-3D237854-26r1-3D237853-26r2-3D237854-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=FQjS7sJFHjqq1VVoTFnx0GeYuZgRudIlT5kCrScFIxw&s=1aO6Y3bx7Cnf23ArRdWvoUq97K953O_ODYLfVAJTCvk&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WinEHPrepare.cpp?rev=237854&r1=237853&r2=237854&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/WinEHPrepare.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/WinEHPrepare.cpp Wed May 20 18:22:24 2015<br>
@@ -91,6 +91,7 @@ public:<br>
 private:<br>
   bool prepareExceptionHandlers(Function &F,<br>
                                 SmallVectorImpl<LandingPadInst *> &LPads);<br>
+  void identifyEHBlocks(Function &F, SmallVectorImpl<LandingPadInst *> &LPads);<br>
   void promoteLandingPadValues(LandingPadInst *LPad);<br>
   void demoteValuesLiveAcrossHandlers(Function &F,<br>
                                       SmallVectorImpl<LandingPadInst *> &LPads);<br>
@@ -127,6 +128,9 @@ private:<br>
   CatchHandlerMapTy CatchHandlerMap;<br>
   CleanupHandlerMapTy CleanupHandlerMap;<br>
   DenseMap<const LandingPadInst *, LandingPadMap> LPadMaps;<br>
+  SmallPtrSet<BasicBlock *, 4> NormalBlocks;<br>
+  SmallPtrSet<BasicBlock *, 4> EHBlocks;<br>
+  SetVector<BasicBlock *> EHReturnBlocks;<br>
<br>
   // This maps landing pad instructions found in outlined handlers to<br>
   // the landing pad instruction in the parent function from which they<br>
@@ -214,6 +218,9 @@ public:<br>
   virtual CloningAction handleTypeIdFor(ValueToValueMapTy &VMap,<br>
                                         const Instruction *Inst,<br>
                                         BasicBlock *NewBB) = 0;<br>
+  virtual CloningAction handleIndirectBr(ValueToValueMapTy &VMap,<br>
+                                         const IndirectBrInst *IBr,<br>
+                                         BasicBlock *NewBB) = 0;<br>
   virtual CloningAction handleInvoke(ValueToValueMapTy &VMap,<br>
                                      const InvokeInst *Invoke,<br>
                                      BasicBlock *NewBB) = 0;<br>
@@ -244,10 +251,12 @@ public:<br>
   WinEHCatchDirector(<br>
       Function *CatchFn, Value *ParentFP, Value *Selector,<br>
       FrameVarInfoMap &VarInfo, LandingPadMap &LPadMap,<br>
-      DenseMap<LandingPadInst *, const LandingPadInst *> &NestedLPads)<br>
+      DenseMap<LandingPadInst *, const LandingPadInst *> &NestedLPads,<br>
+      DominatorTree *DT, SmallPtrSetImpl<BasicBlock *> &EHBlocks)<br>
       : WinEHCloningDirectorBase(CatchFn, ParentFP, VarInfo, LPadMap),<br>
         CurrentSelector(Selector->stripPointerCasts()),<br>
-        ExceptionObjectVar(nullptr), NestedLPtoOriginalLP(NestedLPads) {}<br>
+        ExceptionObjectVar(nullptr), NestedLPtoOriginalLP(NestedLPads),<br>
+        DT(DT), EHBlocks(EHBlocks) {}<br>
<br>
   CloningAction handleBeginCatch(ValueToValueMapTy &VMap,<br>
                                  const Instruction *Inst,<br>
@@ -257,6 +266,9 @@ public:<br>
   CloningAction handleTypeIdFor(ValueToValueMapTy &VMap,<br>
                                 const Instruction *Inst,<br>
                                 BasicBlock *NewBB) override;<br>
+  CloningAction handleIndirectBr(ValueToValueMapTy &VMap,<br>
+                                 const IndirectBrInst *IBr,<br>
+                                 BasicBlock *NewBB) override;<br>
   CloningAction handleInvoke(ValueToValueMapTy &VMap, const InvokeInst *Invoke,<br>
                              BasicBlock *NewBB) override;<br>
   CloningAction handleResume(ValueToValueMapTy &VMap, const ResumeInst *Resume,<br>
@@ -279,6 +291,8 @@ private:<br>
   // This will be a reference to the field of the same name in the WinEHPrepare<br>
   // object which instantiates this WinEHCatchDirector object.<br>
   DenseMap<LandingPadInst *, const LandingPadInst *> &NestedLPtoOriginalLP;<br>
+  DominatorTree *DT;<br>
+  SmallPtrSetImpl<BasicBlock *> &EHBlocks;<br>
 };<br>
<br>
 class WinEHCleanupDirector : public WinEHCloningDirectorBase {<br>
@@ -296,6 +310,9 @@ public:<br>
   CloningAction handleTypeIdFor(ValueToValueMapTy &VMap,<br>
                                 const Instruction *Inst,<br>
                                 BasicBlock *NewBB) override;<br>
+  CloningAction handleIndirectBr(ValueToValueMapTy &VMap,<br>
+                                 const IndirectBrInst *IBr,<br>
+                                 BasicBlock *NewBB) override;<br>
   CloningAction handleInvoke(ValueToValueMapTy &VMap, const InvokeInst *Invoke,<br>
                              BasicBlock *NewBB) override;<br>
   CloningAction handleResume(ValueToValueMapTy &VMap, const ResumeInst *Resume,<br>
@@ -525,13 +542,8 @@ void WinEHPrepare::findSEHEHReturnPoints<br>
   }<br>
 }<br>
<br>
-/// Ensure that all values live into and out of exception handlers are stored<br>
-/// in memory.<br>
-/// FIXME: This falls down when values are defined in one handler and live into<br>
-/// another handler. For example, a cleanup defines a value used only by a<br>
-/// catch handler.<br>
-void WinEHPrepare::demoteValuesLiveAcrossHandlers(<br>
-    Function &F, SmallVectorImpl<LandingPadInst *> &LPads) {<br>
+void WinEHPrepare::identifyEHBlocks(Function &F,<br>
+                                    SmallVectorImpl<LandingPadInst *> &LPads) {<br>
   DEBUG(dbgs() << "Demoting values live across exception handlers in function "<br>
                << F.getName() << '\n');<br>
<br>
@@ -541,10 +553,6 @@ void WinEHPrepare::demoteValuesLiveAcros<br>
   // - Exceptional blocks are blocks reachable from landingpads. Analysis does<br>
   //   not follow llvm.eh.endcatch blocks, which mark a transition from<br>
   //   exceptional to normal control.<br>
-  SmallPtrSet<BasicBlock *, 4> NormalBlocks;<br>
-  SmallPtrSet<BasicBlock *, 4> EHBlocks;<br>
-  SetVector<BasicBlock *> EHReturnBlocks;<br>
-  SetVector<BasicBlock *> Worklist;<br>
<br>
   if (Personality == EHPersonality::MSVC_CXX)<br>
     findCXXEHReturnPoints(F, EHReturnBlocks);<br>
@@ -567,6 +575,7 @@ void WinEHPrepare::demoteValuesLiveAcros<br>
<br>
   // Normal blocks are the blocks reachable from the entry block and all EH<br>
   // return points.<br>
+  SetVector<BasicBlock *> Worklist;<br>
   Worklist = EHReturnBlocks;<br>
   Worklist.insert(&F.getEntryBlock());<br>
   findReachableBlocks(NormalBlocks, Worklist, nullptr);<br>
@@ -588,6 +597,21 @@ void WinEHPrepare::demoteValuesLiveAcros<br>
       dbgs() << "  " << BB->getName() << '\n';<br>
   });<br>
<br>
+}<br>
+<br>
+/// Ensure that all values live into and out of exception handlers are stored<br>
+/// in memory.<br>
+/// FIXME: This falls down when values are defined in one handler and live into<br>
+/// another handler. For example, a cleanup defines a value used only by a<br>
+/// catch handler.<br>
+void WinEHPrepare::demoteValuesLiveAcrossHandlers(<br>
+    Function &F, SmallVectorImpl<LandingPadInst *> &LPads) {<br>
+  DEBUG(dbgs() << "Demoting values live across exception handlers in function "<br>
+               << F.getName() << '\n');<br>
+<br>
+  // identifyEHBlocks() should have been called before this function.<br>
+  assert(!NormalBlocks.empty());<br>
+<br>
   SetVector<Argument *> ArgsToDemote;<br>
   SetVector<Instruction *> InstrsToDemote;<br>
   for (BasicBlock &BB : F) {<br>
@@ -678,6 +702,7 @@ bool WinEHPrepare::prepareExceptionHandl<br>
         return false;<br>
   }<br>
<br>
+  identifyEHBlocks(F, LPads);<br>
   demoteValuesLiveAcrossHandlers(F, LPads);<br>
<br>
   // These containers are used to re-map frame variables that are used in<br>
@@ -702,6 +727,16 @@ bool WinEHPrepare::prepareExceptionHandl<br>
                        F.getEntryBlock().getFirstInsertionPt());<br>
   }<br>
<br>
+  // In order to handle the case where one outlined catch handler returns<br>
+  // to a block within another outlined catch handler that would otherwise<br>
+  // be unreachable, we need to outline the nested landing pad before we<br>
+  // outline the landing pad which encloses it.<br>
+  if (!isAsynchronousEHPersonality(Personality))<br>
+    std::sort(LPads.begin(), LPads.end(),<br>
+              [this](LandingPadInst* &L, LandingPadInst* &R) {<br>
+                return DT->dominates(R->getParent(), L->getParent());<br>
+              });<br></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote"><div>This doesn't seem to be a strict weak ordering - an stl with weak ordering assertions enabled dislikes that we put that into std::sort...</div><div>   what():  strict weak ordering: (__x LT __x) != false</div></div></div><div dir="ltr"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
   // This container stores the llvm.eh.recover and IndirectBr instructions<br>
   // that make up the body of each landing pad after it has been outlined.<br>
   // We need to defer the population of the target list for the indirectbr<br>
@@ -829,28 +864,24 @@ bool WinEHPrepare::prepareExceptionHandl<br>
     CallInst *Recover =<br>
         CallInst::Create(ActionIntrin, ActionArgs, "recover", LPadBB);<br>
<br>
-    if (isAsynchronousEHPersonality(Personality)) {<br>
-      // SEH can create the target list directly, since catch handlers<br>
-      // are not outlined.<br>
-      SetVector<BasicBlock *> ReturnTargets;<br>
-      for (ActionHandler *Action : Actions) {<br>
-        if (auto *CatchAction = dyn_cast<CatchHandler>(Action)) {<br>
-          const auto &CatchTargets = CatchAction->getReturnTargets();<br>
-          ReturnTargets.insert(CatchTargets.begin(), CatchTargets.end());<br>
-        }<br>
+    SetVector<BasicBlock *> ReturnTargets;<br>
+    for (ActionHandler *Action : Actions) {<br>
+      if (auto *CatchAction = dyn_cast<CatchHandler>(Action)) {<br>
+        const auto &CatchTargets = CatchAction->getReturnTargets();<br>
+        ReturnTargets.insert(CatchTargets.begin(), CatchTargets.end());<br>
       }<br>
-      IndirectBrInst *Branch =<br>
-          IndirectBrInst::Create(Recover, ReturnTargets.size(), LPadBB);<br>
-      for (BasicBlock *Target : ReturnTargets)<br>
-        Branch->addDestination(Target);<br>
-    } else {<br>
-      // C++ EH must defer populating the targets to handle the case of<br>
-      // targets that are reached indirectly through nested landing pads.<br>
-      IndirectBrInst *Branch =<br>
-          IndirectBrInst::Create(Recover, 0, LPadBB);<br>
+    }<br>
+    IndirectBrInst *Branch =<br>
+        IndirectBrInst::Create(Recover, ReturnTargets.size(), LPadBB);<br>
+    for (BasicBlock *Target : ReturnTargets)<br>
+      Branch->addDestination(Target);<br>
<br>
+    if (!isAsynchronousEHPersonality(Personality)) {<br>
+      // C++ EH must repopulate the targets later to handle the case of<br>
+      // targets that are reached indirectly through nested landing pads.<br>
       LPadImpls.push_back(std::make_pair(Recover, Branch));<br>
     }<br>
+<br>
   } // End for each landingpad<br>
<br>
   // If nothing got outlined, there is no more processing to be done.<br>
@@ -864,8 +895,7 @@ bool WinEHPrepare::prepareExceptionHandl<br>
     completeNestedLandingPad(&F, LPadPair.first, LPadPair.second, FrameVarInfo);<br>
   NestedLPtoOriginalLP.clear();<br>
<br>
-  // Populate the indirectbr instructions' target lists if we deferred<br>
-  // doing so above.<br>
+  // Update the indirectbr instructions' target lists if necessary.<br>
   SetVector<BasicBlock*> CheckedTargets;<br>
   SmallVector<std::unique_ptr<ActionHandler>, 4> ActionList;<br>
   for (auto &LPadImplPair : LPadImpls) {<br>
@@ -884,6 +914,12 @@ bool WinEHPrepare::prepareExceptionHandl<br>
       }<br>
     }<br>
     ActionList.clear();<br>
+    // Clear any targets we already knew about.<br>
+    for (unsigned int I = 0, E = Branch->getNumDestinations(); I < E; ++I) {<br>
+      BasicBlock *KnownTarget = Branch->getDestination(I);<br>
+      if (ReturnTargets.count(KnownTarget))<br>
+        ReturnTargets.remove(KnownTarget);<br>
+    }<br>
     for (BasicBlock *Target : ReturnTargets) {<br>
       Branch->addDestination(Target);<br>
       // The target may be a block that we excepted to get pruned.<br>
@@ -994,6 +1030,9 @@ bool WinEHPrepare::prepareExceptionHandl<br>
   HandlerToParentFP.clear();<br>
   DT = nullptr;<br>
   SEHExceptionCodeSlot = nullptr;<br>
+  EHBlocks.clear();<br>
+  NormalBlocks.clear();<br>
+  EHReturnBlocks.clear();<br>
<br>
   return HandlersOutlined;<br>
 }<br>
@@ -1079,10 +1118,19 @@ void WinEHPrepare::completeNestedLanding<br>
   // temporarily inserted as its terminator.<br>
   LLVMContext &Context = ParentFn->getContext();<br>
   BasicBlock *OutlinedBB = OutlinedLPad->getParent();<br>
-  assert(isa<UnreachableInst>(OutlinedBB->getTerminator()));<br>
-  OutlinedBB->getTerminator()->eraseFromParent();<br>
-  // That should leave OutlinedLPad as the last instruction in its block.<br>
-  assert(&OutlinedBB->back() == OutlinedLPad);<br>
+  // If the nested landing pad was outlined before the landing pad that enclosed<br>
+  // it, it will already be in outlined form.  In that case, we just need to see<br>
+  // if the returns and the enclosing branch instruction need to be updated.<br>
+  IndirectBrInst *Branch =<br>
+      dyn_cast<IndirectBrInst>(OutlinedBB->getTerminator());<br>
+  if (!Branch) {<br>
+    // If the landing pad wasn't in outlined form, it should be a stub with<br>
+    // an unreachable terminator.<br>
+    assert(isa<UnreachableInst>(OutlinedBB->getTerminator()));<br>
+    OutlinedBB->getTerminator()->eraseFromParent();<br>
+    // That should leave OutlinedLPad as the last instruction in its block.<br>
+    assert(&OutlinedBB->back() == OutlinedLPad);<br>
+  }<br>
<br>
   // The original landing pad will have already had its action intrinsic<br>
   // built by the outlining loop.  We need to clone that into the outlined<br>
@@ -1096,9 +1144,9 @@ void WinEHPrepare::completeNestedLanding<br>
   // The instruction after the landing pad should now be a call to eh.actions.<br>
   const Instruction *Recover = II;<br>
   assert(match(Recover, m_Intrinsic<Intrinsic::eh_actions>()));<br>
-  IntrinsicInst *EHActions = cast<IntrinsicInst>(Recover->clone());<br>
+  const IntrinsicInst *EHActions = cast<IntrinsicInst>(Recover);<br>
<br>
-  // Remap the exception variables into the outlined function.<br>
+  // Remap the return target in the nested handler.<br>
   SmallVector<BlockAddress *, 4> ActionTargets;<br>
   SmallVector<std::unique_ptr<ActionHandler>, 4> ActionList;<br>
   parseEHActions(EHActions, ActionList);<br>
@@ -1125,7 +1173,7 @@ void WinEHPrepare::completeNestedLanding<br>
       // should be a block that was outlined into OutlinedHandlerFn.<br>
       assert(BA->getFunction() == ParentFn);<br>
<br>
-      // Ignore targets that aren't part of OutlinedHandlerFn.<br>
+      // Ignore targets that aren't part of an outlined handler function.<br>
       if (!LPadTargetBlocks.count(BA->getBasicBlock()))<br>
         continue;<br>
<br>
@@ -1142,13 +1190,25 @@ void WinEHPrepare::completeNestedLanding<br>
     }<br>
   }<br>
   ActionList.clear();<br>
-  OutlinedBB->getInstList().push_back(EHActions);<br>
<br>
-  // Insert an indirect branch into the outlined landing pad BB.<br>
-  IndirectBrInst *IBr = IndirectBrInst::Create(EHActions, 0, OutlinedBB);<br>
-  // Add the previously collected action targets.<br>
-  for (auto *Target : ActionTargets)<br>
-    IBr->addDestination(Target->getBasicBlock());<br>
+  if (Branch) {<br>
+    // If the landing pad was already in outlined form, just update its targets.<br>
+    for (unsigned int I = Branch->getNumDestinations(); I > 0; --I)<br>
+      Branch->removeDestination(I);<br>
+    // Add the previously collected action targets.<br>
+    for (auto *Target : ActionTargets)<br>
+      Branch->addDestination(Target->getBasicBlock());<br>
+  } else {<br>
+    // If the landing pad was previously stubbed out, fill in its outlined form.<br>
+    IntrinsicInst *NewEHActions = cast<IntrinsicInst>(EHActions->clone());<br>
+    OutlinedBB->getInstList().push_back(NewEHActions);<br>
+<br>
+    // Insert an indirect branch into the outlined landing pad BB.<br>
+    IndirectBrInst *IBr = IndirectBrInst::Create(NewEHActions, 0, OutlinedBB);<br>
+    // Add the previously collected action targets.<br>
+    for (auto *Target : ActionTargets)<br>
+      IBr->addDestination(Target->getBasicBlock());<br>
+  }<br>
 }<br>
<br>
 // This function examines a block to determine whether the block ends with a<br>
@@ -1326,9 +1386,9 @@ bool WinEHPrepare::outlineHandler(Action<br>
     LPadMap.mapLandingPad(LPad);<br>
   if (auto *CatchAction = dyn_cast<CatchHandler>(Action)) {<br>
     Constant *Sel = CatchAction->getSelector();<br>
-    Director.reset(new WinEHCatchDirector(Handler, ParentFP, Sel,<br>
-                                          VarInfo, LPadMap,<br>
-                                          NestedLPtoOriginalLP));<br>
+    Director.reset(new WinEHCatchDirector(Handler, ParentFP, Sel, VarInfo,<br>
+                                          LPadMap, NestedLPtoOriginalLP, DT,<br>
+                                          EHBlocks));<br>
     LPadMap.remapEHValues(VMap, UndefValue::get(Int8PtrType),<br>
                           ConstantInt::get(Type::getInt32Ty(Context), 1));<br>
   } else {<br>
@@ -1532,15 +1592,22 @@ CloningDirector::CloningAction WinEHClon<br>
   if (LPadMap.isLandingPadSpecificInst(Inst))<br>
     return CloningDirector::SkipInstruction;<br>
<br>
-  // Nested landing pads will be cloned as stubs, with just the<br>
-  // landingpad instruction and an unreachable instruction. When<br>
-  // all landingpads have been outlined, we'll replace this with the<br>
-  // llvm.eh.actions call and indirect branch created when the<br>
-  // landing pad was outlined.<br>
+  // Nested landing pads that have not already been outlined will be cloned as<br>
+  // stubs, with just the landingpad instruction and an unreachable instruction.<br>
+  // When all landingpads have been outlined, we'll replace this with the<br>
+  // llvm.eh.actions call and indirect branch created when the landing pad was<br>
+  // outlined.<br>
   if (auto *LPad = dyn_cast<LandingPadInst>(Inst)) {<br>
     return handleLandingPad(VMap, LPad, NewBB);<br>
   }<br>
<br>
+  // Nested landing pads that have already been outlined will be cloned in their<br>
+  // outlined form, but we need to intercept the ibr instruction to filter out<br>
+  // targets that do not return to the handler we are outlining.<br>
+  if (auto *IBr = dyn_cast<IndirectBrInst>(Inst)) {<br>
+    return handleIndirectBr(VMap, IBr, NewBB);<br>
+  }<br>
+<br>
   if (auto *Invoke = dyn_cast<InvokeInst>(Inst))<br>
     return handleInvoke(VMap, Invoke, NewBB);<br>
<br>
@@ -1570,6 +1637,20 @@ CloningDirector::CloningAction WinEHClon<br>
<br>
 CloningDirector::CloningAction WinEHCatchDirector::handleLandingPad(<br>
     ValueToValueMapTy &VMap, const LandingPadInst *LPad, BasicBlock *NewBB) {<br>
+  // If the instruction after the landing pad is a call to llvm.eh.actions<br>
+  // the landing pad has already been outlined.  In this case, we should<br>
+  // clone it because it may return to a block in the handler we are<br>
+  // outlining now that would otherwise be unreachable.  The landing pads<br>
+  // are sorted before outlining begins to enable this case to work<br>
+  // properly.<br>
+  const Instruction *NextI = LPad->getNextNode();<br>
+  if (match(NextI, m_Intrinsic<Intrinsic::eh_actions>()))<br>
+    return CloningDirector::CloneInstruction;<br>
+<br>
+  // If the landing pad hasn't been outlined yet, the landing pad we are<br>
+  // outlining now does not dominate it and so it cannot return to a block<br>
+  // in this handler.  In that case, we can just insert a stub landing<br>
+  // pad now and patch it up later.<br>
   Instruction *NewInst = LPad->clone();<br>
   if (LPad->hasName())<br>
     NewInst->setName(LPad->getName());<br>
@@ -1661,6 +1742,48 @@ CloningDirector::CloningAction WinEHCatc<br>
   return CloningDirector::SkipInstruction;<br>
 }<br>
<br>
+CloningDirector::CloningAction WinEHCatchDirector::handleIndirectBr(<br>
+    ValueToValueMapTy &VMap,<br>
+    const IndirectBrInst *IBr,<br>
+    BasicBlock *NewBB) {<br>
+  // If this indirect branch is not part of a landing pad block, just clone it.<br>
+  const BasicBlock *ParentBB = IBr->getParent();<br>
+  if (!ParentBB->isLandingPad())<br>
+    return CloningDirector::CloneInstruction;<br>
+<br>
+  // If it is part of a landing pad, we want to filter out target blocks<br>
+  // that are not part of the handler we are outlining.<br>
+  const LandingPadInst *LPad = ParentBB->getLandingPadInst();<br>
+<br>
+  // Save this correlation for later processing.<br>
+  NestedLPtoOriginalLP[cast<LandingPadInst>(VMap[LPad])] = LPad;<br>
+<br>
+  // We should only get here for landing pads that have already been outlined.<br>
+  assert(match(LPad->getNextNode(), m_Intrinsic<Intrinsic::eh_actions>()));<br>
+<br>
+  // Copy the indirectbr, but only include targets that were previously<br>
+  // identified as EH blocks and are dominated by the nested landing pad.<br>
+  SetVector<const BasicBlock *> ReturnTargets;<br>
+  for (int I = 0, E = IBr->getNumDestinations(); I < E; ++I) {<br>
+    auto *TargetBB = IBr->getDestination(I);<br>
+    if (EHBlocks.count(const_cast<BasicBlock*>(TargetBB)) &&<br>
+        DT->dominates(ParentBB, TargetBB)) {<br>
+      DEBUG(dbgs() << "  Adding destination " << TargetBB->getName() << "\n");<br>
+      ReturnTargets.insert(TargetBB);<br>
+    }<br>
+  }<br>
+  IndirectBrInst *NewBranch =<br>
+        IndirectBrInst::Create(const_cast<Value *>(IBr->getAddress()),<br>
+                               ReturnTargets.size(), NewBB);<br>
+  for (auto *Target : ReturnTargets)<br>
+    NewBranch->addDestination(const_cast<BasicBlock*>(Target));<br>
+<br>
+  // The operands and targets of the branch instruction are remapped later<br>
+  // because it is a terminator.  Tell the cloning code to clone the<br>
+  // blocks we just added to the target list.<br>
+  return CloningDirector::CloneSuccessors;<br>
+}<br>
+<br>
 CloningDirector::CloningAction<br>
 WinEHCatchDirector::handleInvoke(ValueToValueMapTy &VMap,<br>
                                  const InvokeInst *Invoke, BasicBlock *NewBB) {<br>
@@ -1750,6 +1873,14 @@ CloningDirector::CloningAction WinEHClea<br>
   return CloningDirector::SkipInstruction;<br>
 }<br>
<br>
+CloningDirector::CloningAction WinEHCleanupDirector::handleIndirectBr(<br>
+    ValueToValueMapTy &VMap,<br>
+    const IndirectBrInst *IBr,<br>
+    BasicBlock *NewBB) {<br>
+  // No special handling is required for cleanup cloning.<br>
+  return CloningDirector::CloneInstruction;<br>
+}<br>
+<br>
 CloningDirector::CloningAction WinEHCleanupDirector::handleInvoke(<br>
     ValueToValueMapTy &VMap, const InvokeInst *Invoke, BasicBlock *NewBB) {<br>
   // All invokes in cleanup handlers can be replaced with calls.<br>
<br>
Modified: llvm/trunk/test/CodeGen/WinEH/cppeh-nested-1.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_WinEH_cppeh-2Dnested-2D1.ll-3Frev-3D237854-26r1-3D237853-26r2-3D237854-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=FQjS7sJFHjqq1VVoTFnx0GeYuZgRudIlT5kCrScFIxw&s=Mn-k5aIYcnXEbOWjE0WoLjy1oMaj0qZJ_qO3Ad2wnos&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/cppeh-nested-1.ll?rev=237854&r1=237853&r2=237854&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/WinEH/cppeh-nested-1.ll (original)<br>
+++ llvm/trunk/test/CodeGen/WinEH/cppeh-nested-1.ll Wed May 20 18:22:24 2015<br>
@@ -34,7 +34,7 @@ $"\01??_R0H@8" = comdat any<br>
 ; CHECK: entry:<br>
 ; CHECK:   %i = alloca i32, align 4<br>
 ; CHECK:   %f = alloca float, align 4<br>
-; CHECK:   call void (...) @llvm.frameescape(i32* %i, float* %f)<br>
+; CHECK:   call void (...) @llvm.frameescape(float* %f, i32* %i)<br>
 ; CHECK:   invoke void @"\01?may_throw@@YAXXZ"()<br>
 ; CHECK:           to label %invoke.cont unwind label %[[LPAD_LABEL:lpad[0-9]*]]<br>
<br>
@@ -55,8 +55,8 @@ invoke.cont:<br>
 ; CHECK:   landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)<br>
 ; CHECK:           catch i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*)<br>
 ; CHECK:           catch i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*)<br>
-; CHECK:   [[RECOVER:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*), i32 0, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch", i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*), i32 1, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch.1")<br>
-; CHECK:   indirectbr i8* [[RECOVER]], [label %try.cont10, label %try.cont]<br>
+; CHECK:   [[RECOVER:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*), i32 1, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch.1", i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*), i32 0, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch")<br>
+; CHECK:   indirectbr i8* [[RECOVER]], [label %try.cont, label %try.cont10]<br>
<br>
 lpad:                                             ; preds = %entry<br>
   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)<br>
@@ -136,7 +136,16 @@ eh.resume:<br>
<br>
 ; CHECK: define internal i8* @"\01?test@@YAXXZ.catch"(i8*, i8*)<br>
 ; CHECK: entry:<br>
-; CHECK:   [[RECOVER_I:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 0)<br>
+; CHECK:   [[RECOVER_F1:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 0)<br>
+; CHECK:   [[F_PTR1:\%.+]] = bitcast i8* [[RECOVER_F1]] to float*<br>
+; CHECK:   [[TMP2:\%.+]] = load float, float* [[F_PTR1]], align 4<br>
+; CHECK:   call void @"\01?handle_float@@YAXM@Z"(float [[TMP2]])<br>
+; CHECK:   ret i8* blockaddress(@"\01?test@@YAXXZ", %try.cont10)<br>
+; CHECK: }<br>
+<br>
+; CHECK: define internal i8* @"\01?test@@YAXXZ.catch.1"(i8*, i8*)<br>
+; CHECK: entry:<br>
+; CHECK:   [[RECOVER_I:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 1)<br>
 ; CHECK:   [[I_PTR:\%.+]] = bitcast i8* [[RECOVER_I]] to i32*<br>
 ; CHECK:   [[TMP1:\%.+]] = load i32, i32* [[I_PTR]], align 4<br>
 ; CHECK:   invoke void @"\01?handle_int@@YAXH@Z"(i32 [[TMP1]])<br>
@@ -148,20 +157,11 @@ eh.resume:<br>
 ; CHECK: [[LPAD1_LABEL]]:{{[ ]+}}; preds = %entry<br>
 ; CHECK:   [[LPAD1_VAL:\%.+]] = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)<br>
 ; CHECK:           catch i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*)<br>
-; CHECK:   [[RECOVER1:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*), i32 1, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch.1")<br>
+; CHECK:   [[RECOVER1:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*), i32 0, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch")<br>
 ; CHECK:   indirectbr i8* [[RECOVER1]], []<br>
 ;<br>
 ; CHECK: }<br>
<br>
-; CHECK: define internal i8* @"\01?test@@YAXXZ.catch.1"(i8*, i8*)<br>
-; CHECK: entry:<br>
-; CHECK:   [[RECOVER_F1:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 1)<br>
-; CHECK:   [[F_PTR1:\%.+]] = bitcast i8* [[RECOVER_F1]] to float*<br>
-; CHECK:   [[TMP2:\%.+]] = load float, float* [[F_PTR1]], align 4<br>
-; CHECK:   call void @"\01?handle_float@@YAXM@Z"(float [[TMP2]])<br>
-; CHECK:   ret i8* blockaddress(@"\01?test@@YAXXZ", %try.cont10)<br>
-; CHECK: }<br>
-<br>
<br>
 declare void @"\01?may_throw@@YAXXZ"() #1<br>
<br>
<br>
Modified: llvm/trunk/test/CodeGen/WinEH/cppeh-nested-2.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_WinEH_cppeh-2Dnested-2D2.ll-3Frev-3D237854-26r1-3D237853-26r2-3D237854-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=FQjS7sJFHjqq1VVoTFnx0GeYuZgRudIlT5kCrScFIxw&s=oXOwz7HUfTxpSgAkefkBtj0jz4rBtmHLbpKwYK5ld30&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/cppeh-nested-2.ll?rev=237854&r1=237853&r2=237854&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/WinEH/cppeh-nested-2.ll (original)<br>
+++ llvm/trunk/test/CodeGen/WinEH/cppeh-nested-2.ll Wed May 20 18:22:24 2015<br>
@@ -114,7 +114,7 @@ lpad:<br>
 ; CHECK-SAME:       i32 1, i8* bitcast (i8** @_ZTIi to i8*), i32 1, i8* (i8*, i8*)* @_Z4testv.catch.1,<br>
 ; CHECK-SAME:       i32 0, void (i8*, i8*)* @_Z4testv.cleanup,<br>
 ; CHECK-SAME:       i32 1, i8* bitcast (i8** @_ZTIf to i8*), i32 0, i8* (i8*, i8*)* @_Z4testv.catch)<br>
-; CHECK-NEXT:   indirectbr i8* [[RECOVER1]], [label %try.cont19, label %try.cont]<br>
+; CHECK-NEXT:   indirectbr i8* [[RECOVER1]], [label %try.cont, label %try.cont19]<br>
<br>
 lpad1:                                            ; preds = %invoke.cont4, %invoke.cont<br>
   %tmp3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)<br>
@@ -137,7 +137,7 @@ lpad1:<br>
 ; CHECK-SAME:       i32 1, i8* bitcast (i8** @_ZTIi to i8*), i32 1, i8* (i8*, i8*)* @_Z4testv.catch.1,<br>
 ; CHECK-SAME:       i32 0, void (i8*, i8*)* @_Z4testv.cleanup,<br>
 ; CHECK-SAME:       i32 1, i8* bitcast (i8** @_ZTIf to i8*), i32 0, i8* (i8*, i8*)* @_Z4testv.catch)<br>
-; CHECK-NEXT:   indirectbr i8* [[RECOVER3]], [label %try.cont19, label %try.cont]<br>
+; CHECK-NEXT:   indirectbr i8* [[RECOVER3]], [label %try.cont, label %try.cont19]<br>
<br>
 lpad3:                                            ; preds = %invoke.cont2<br>
   %tmp6 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)<br>
<br>
Modified: llvm/trunk/test/CodeGen/WinEH/cppeh-nested-3.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_WinEH_cppeh-2Dnested-2D3.ll-3Frev-3D237854-26r1-3D237853-26r2-3D237854-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=FQjS7sJFHjqq1VVoTFnx0GeYuZgRudIlT5kCrScFIxw&s=9f9rKgZfGmN_O3Kn_ya7wM74ZXe3NU8JITUqyaw8E-E&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/cppeh-nested-3.ll?rev=237854&r1=237853&r2=237854&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/WinEH/cppeh-nested-3.ll (original)<br>
+++ llvm/trunk/test/CodeGen/WinEH/cppeh-nested-3.ll Wed May 20 18:22:24 2015<br>
@@ -41,7 +41,7 @@ $"\01??_R0H@8" = comdat any<br>
 ; CHECK:   %i = alloca i32, align 4<br>
 ; CHECK:   %j = alloca i32, align 4<br>
 ; CHECK:   %f = alloca float, align 4<br>
-; CHECK:   call void (...) @llvm.frameescape(i32* %i, float* %f, i32* %j)<br>
+; CHECK:   call void (...) @llvm.frameescape(i32* %j, i32* %i, float* %f)<br>
 ; CHECK:   invoke void @"\01?may_throw@@YAXXZ"()<br>
 ; CHECK:           to label %invoke.cont unwind label %[[LPAD_LABEL:lpad[0-9]*]]<br>
<br>
@@ -63,8 +63,8 @@ invoke.cont:<br>
 ; CHECK:   landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)<br>
 ; CHECK:           catch i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*)<br>
 ; CHECK:           catch i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*)<br>
-; CHECK:   [[RECOVER:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*), i32 0, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch", i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*), i32 1, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch.1")<br>
-; CHECK:   indirectbr i8* [[RECOVER]], [label %try.cont19, label %try.cont10]<br>
+; CHECK:   [[RECOVER:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*), i32 1, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch.2", i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*), i32 2, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch.1")<br>
+; CHECK:   indirectbr i8* [[RECOVER]], [label %try.cont10, label %try.cont19]<br>
<br>
 lpad:                                             ; preds = %entry<br>
   %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)<br>
@@ -181,7 +181,27 @@ eh.resume:<br>
<br>
 ; CHECK: define internal i8* @"\01?test@@YAXXZ.catch"(i8*, i8*)<br>
 ; CHECK: entry:<br>
-; CHECK:   [[RECOVER_I:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 0)<br>
+; CHECK:   [[RECOVER_J:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 0)<br>
+; CHECK:   [[J_PTR:\%.+]] = bitcast i8* [[RECOVER_J]] to i32*<br>
+; CHECK:   [[RECOVER_I1:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 1)<br>
+; CHECK:   [[I_PTR1:\%.+]] = bitcast i8* [[RECOVER_I1]] to i32*<br>
+; CHECK:   [[TMP3:\%.+]] = load i32, i32* [[J_PTR]], align 4<br>
+; CHECK:   store i32 [[TMP3]], i32* [[I_PTR1]]<br>
+; CHECK:   ret i8* blockaddress(@"\01?test@@YAXXZ.catch.2", %invoke.cont2)<br>
+; CHECK: }<br>
+<br>
+; CHECK: define internal i8* @"\01?test@@YAXXZ.catch.1"(i8*, i8*)<br>
+; CHECK: entry:<br>
+; CHECK:   [[RECOVER_F:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 2)<br>
+; CHECK:   [[F_PTR:\%.+]] = bitcast i8* [[RECOVER_F]] to float*<br>
+; CHECK:   [[TMP2:\%.+]] = load float, float* [[F_PTR]], align 4<br>
+; CHECK:   call void @"\01?handle_float@@YAXM@Z"(float [[TMP2]])<br>
+; CHECK:   ret i8* blockaddress(@"\01?test@@YAXXZ", %try.cont19)<br>
+; CHECK: }<br>
+<br>
+; CHECK: define internal i8* @"\01?test@@YAXXZ.catch.2"(i8*, i8*)<br>
+; CHECK: entry:<br>
+; CHECK:   [[RECOVER_I:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 1)<br>
 ; CHECK:   [[I_PTR:\%.+]] = bitcast i8* [[RECOVER_I]] to i32*<br>
 ; CHECK:   invoke void @"\01?may_throw@@YAXXZ"()<br>
 ; CHECK:           to label %invoke.cont2 unwind label %[[LPAD1_LABEL:lpad[0-9]*]]<br>
@@ -195,7 +215,7 @@ eh.resume:<br>
 ; CHECK:   [[LPAD1_VAL:\%.+]] = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)<br>
 ; CHECK:           catch i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*)<br>
 ; CHECK:           catch i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*)<br>
-; CHECK:   [[RECOVER1:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*), i32 2, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch.2", i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*), i32 1, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch.1")<br>
+; CHECK:   [[RECOVER1:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*), i32 0, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch", i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*), i32 2, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch.1")<br>
 ; CHECK:   indirectbr i8* [[RECOVER1]], [label %invoke.cont2]<br>
 ;<br>
 ; CHECK: invoke.cont9:<br>
@@ -204,32 +224,11 @@ eh.resume:<br>
 ; CHECK: [[LPAD8_LABEL]]:{{[ ]+}}; preds = %invoke.cont2<br>
 ; CHECK:   [[LPAD8_VAL:\%.+]] = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)<br>
 ; CHECK:           catch i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*)<br>
-; CHECK:   [[RECOVER2:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*), i32 1, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch.1")<br>
+; CHECK:   [[RECOVER2:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0M@8" to i8*), i32 2, i8* (i8*, i8*)* @"\01?test@@YAXXZ.catch.1")<br>
 ; CHECK:   indirectbr i8* [[RECOVER2]], []<br>
 ;<br>
 ; CHECK: }<br>
<br>
-; CHECK: define internal i8* @"\01?test@@YAXXZ.catch.1"(i8*, i8*)<br>
-; CHECK: entry:<br>
-; CHECK:   [[RECOVER_F:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 1)<br>
-; CHECK:   [[F_PTR:\%.+]] = bitcast i8* [[RECOVER_F]] to float*<br>
-; CHECK:   [[TMP2:\%.+]] = load float, float* [[F_PTR]], align 4<br>
-; CHECK:   call void @"\01?handle_float@@YAXM@Z"(float [[TMP2]])<br>
-; CHECK:   ret i8* blockaddress(@"\01?test@@YAXXZ", %try.cont19)<br>
-; CHECK: }<br>
-<br>
-; CHECK: define internal i8* @"\01?test@@YAXXZ.catch.2"(i8*, i8*)<br>
-; CHECK: entry:<br>
-; CHECK:   [[RECOVER_J:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 2)<br>
-; CHECK:   [[J_PTR:\%.+]] = bitcast i8* [[RECOVER_J]] to i32*<br>
-; CHECK:   [[RECOVER_I1:\%.+]] = call i8* @llvm.framerecover(i8* bitcast (void ()* @"\01?test@@YAXXZ" to i8*), i8* %1, i32 0)<br>
-; CHECK:   [[I_PTR1:\%.+]] = bitcast i8* [[RECOVER_I1]] to i32*<br>
-; CHECK:   [[TMP3:\%.+]] = load i32, i32* [[J_PTR]], align 4<br>
-; CHECK:   store i32 [[TMP3]], i32* [[I_PTR1]]<br>
-; CHECK:   ret i8* blockaddress(@"\01?test@@YAXXZ.catch", %invoke.cont2)<br>
-; CHECK: }<br>
-<br>
-<br>
 declare void @"\01?may_throw@@YAXXZ"() #1<br>
<br>
 declare i32 @__CxxFrameHandler3(...)<br>
<br>
Modified: llvm/trunk/test/CodeGen/WinEH/cppeh-nested-rethrow.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_WinEH_cppeh-2Dnested-2Drethrow.ll-3Frev-3D237854-26r1-3D237853-26r2-3D237854-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=FQjS7sJFHjqq1VVoTFnx0GeYuZgRudIlT5kCrScFIxw&s=rjsKubnZ_yNU9yC8_mgGPs6xMzapdWCcPNz4LeYOjwg&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/cppeh-nested-rethrow.ll?rev=237854&r1=237853&r2=237854&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/WinEH/cppeh-nested-rethrow.ll (original)<br>
+++ llvm/trunk/test/CodeGen/WinEH/cppeh-nested-rethrow.ll Wed May 20 18:22:24 2015<br>
@@ -180,26 +180,24 @@ unreachable:<br>
 ; CHECK: }<br>
 }<br>
<br>
-; The outlined test1.catch handler should not contain a return instruction.<br>
+; The outlined test1.catch handler should return to a valid block address.<br>
 ; CHECK-LABEL: define internal i8* @"\01?test1@@YAXXZ.catch"(i8*, i8*)<br>
-; CHECK-NOT: ret<br>
+; CHECK-NOT:  ret i8* inttoptr (i32 1 to i8*)<br>
 ; CHECK: }<br>
<br>
-; The outlined test1.catch1 handler should return to a valid block address.<br>
+; The outlined test1.catch1 handler should not contain a return instruction.<br>
 ; CHECK-LABEL: define internal i8* @"\01?test1@@YAXXZ.catch.1"(i8*, i8*)<br>
-; WILL-CHECK:  ret i8* inttoptr (<br>
-; CHECK-NOT:  ret i8* inttoptr (i32 1 to i8*)<br>
+; CHECK-NOT: ret<br>
 ; CHECK: }<br>
<br>
-; The outlined test2.catch handler should not contain a return instruction.<br>
+; The outlined test2.catch handler should return to a valid block address.<br>
 ; CHECK-LABEL: define internal i8* @"\01?test2@@YAXXZ.catch"(i8*, i8*)<br>
-; CHECK-NOT: ret<br>
+; CHECK-NOT:  ret i8* inttoptr (i32 1 to i8*)<br>
 ; CHECK: }<br>
<br>
-; The outlined test2.catch1 handler should return to a valid block address.<br>
+; The outlined test2.catch2 handler should not contain a return instruction.<br>
 ; CHECK-LABEL: define internal i8* @"\01?test2@@YAXXZ.catch.2"(i8*, i8*)<br>
-; WILL-CHECK:  ret i8* inttoptr (<br>
-; CHECK-NOT:  ret i8* inttoptr (i32 1 to i8*)<br>
+; CHECK-NOT: ret<br>
 ; CHECK: }<br>
<br>
<br>
<br>
Modified: llvm/trunk/test/CodeGen/WinEH/cppeh-similar-catch-blocks.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_WinEH_cppeh-2Dsimilar-2Dcatch-2Dblocks.ll-3Frev-3D237854-26r1-3D237853-26r2-3D237854-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=FQjS7sJFHjqq1VVoTFnx0GeYuZgRudIlT5kCrScFIxw&s=nCy27I3wu-NKwHHCnGjqE8qnTiq7jyEOh8eSagsf8AQ&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/cppeh-similar-catch-blocks.ll?rev=237854&r1=237853&r2=237854&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/WinEH/cppeh-similar-catch-blocks.ll (original)<br>
+++ llvm/trunk/test/CodeGen/WinEH/cppeh-similar-catch-blocks.ll Wed May 20 18:22:24 2015<br>
@@ -86,7 +86,7 @@ $"\01??_C@_03PMGGPEJJ@?$CFd?6?$AA@" = co<br>
 ; This is just a minimal check to verify that main was handled by WinEHPrepare.<br>
 ; CHECK: define i32 @main()<br>
 ; CHECK: entry:<br>
-; CHECK:   call void (...) @llvm.frameescape(i8* [[C_PTR:\%.+]], i32* [[X_PTR:\%.+]], i8* [[C2_PTR:\%.+]], i32* [[X2_PTR:\%.+]], i8* [[C3_PTR:\%.+]])<br>
+; CHECK:   call void (...) @llvm.frameescape(i32* [[X_PTR:\%.+]], i32* [[X2_PTR:\%.+]], i8* [[C2_PTR:\%.+]], i8* [[C3_PTR:\%.+]], i8* [[C_PTR:\%.+]])<br>
 ; CHECK:   invoke void @_CxxThrowException<br>
 ; CHECK: }<br>
<br>
<br>
Modified: llvm/trunk/test/CodeGen/WinEH/cppeh-state-calc-1.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_WinEH_cppeh-2Dstate-2Dcalc-2D1.ll-3Frev-3D237854-26r1-3D237853-26r2-3D237854-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=FQjS7sJFHjqq1VVoTFnx0GeYuZgRudIlT5kCrScFIxw&s=4LCAqUyv2C1FZfLeW3G_olEXY7ZVW-021qvL4e22H0E&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/cppeh-state-calc-1.ll?rev=237854&r1=237853&r2=237854&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/WinEH/cppeh-state-calc-1.ll (original)<br>
+++ llvm/trunk/test/CodeGen/WinEH/cppeh-state-calc-1.ll Wed May 20 18:22:24 2015<br>
@@ -274,16 +274,16 @@ attributes #5 = { noreturn }<br>
 ; CHECK-NEXT:  .long   .Lfunc_begin0@IMGREL<br>
 ; CHECK-NEXT:  .long   -1<br>
 ; CHECK-NEXT:  .long   .Ltmp0@IMGREL<br>
-; CHECK-NEXT:  .long   3<br>
-; CHECK-NEXT:  .long   .Ltmp3@IMGREL<br>
 ; CHECK-NEXT:  .long   2<br>
-; CHECK-NEXT:  .long   .Ltmp6@IMGREL<br>
+; CHECK-NEXT:  .long   .Ltmp3@IMGREL<br>
 ; CHECK-NEXT:  .long   1<br>
+; CHECK-NEXT:  .long   .Ltmp6@IMGREL<br>
+; CHECK-NEXT:  .long   0<br>
 ; CHECK-NEXT:  .long   .Lfunc_begin1@IMGREL<br>
-; CHECK-NEXT:  .long   4<br>
+; CHECK-NEXT:  .long   3<br>
 ; CHECK-NEXT:  .long   .Lfunc_begin2@IMGREL<br>
-; CHECK-NEXT:  .long   5<br>
+; CHECK-NEXT:  .long   4<br>
 ; CHECK-NEXT:  .long   .Lfunc_begin3@IMGREL<br>
-; CHECK-NEXT:  .long   6<br>
+; CHECK-NEXT:  .long   5<br>
 ; CHECK-NEXT:  .long   .Lfunc_begin4@IMGREL<br>
-; CHECK-NEXT:  .long   7<br>
+; CHECK-NEXT:  .long   6<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div></blockquote></div>