[llvm] r235563 - [WinEH] Don't skip landing pads that end with an unreachable instruction.

Andrew Kaylor andrew.kaylor at intel.com
Wed Apr 22 17:20:45 PDT 2015


Author: akaylor
Date: Wed Apr 22 19:20:44 2015
New Revision: 235563

URL: http://llvm.org/viewvc/llvm-project?rev=235563&view=rev
Log:
[WinEH] Don't skip landing pads that end with an unreachable instruction.

Modified:
    llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
    llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll
    llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-catch.ll

Modified: llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WinEHPrepare.cpp?rev=235563&r1=235562&r2=235563&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/WinEHPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/WinEHPrepare.cpp Wed Apr 22 19:20:44 2015
@@ -637,12 +637,6 @@ bool WinEHPrepare::prepareExceptionHandl
         LPadHasActionList = true;
         break;
       }
-      // FIXME: This is here to help with the development of nested landing pad
-      //        outlining.  It should be removed when that is finished.
-      if (isa<UnreachableInst>(Inst)) {
-        LPadHasActionList = true;
-        break;
-      }
     }
 
     // If we've already outlined the handlers for this landingpad,
@@ -1011,6 +1005,10 @@ static BasicBlock *createStubLandingPad(
       llvm::StructType::get(Type::getInt8PtrTy(Context),
                             Type::getInt32Ty(Context), nullptr),
       PersonalityFn, 0);
+  // Insert a call to llvm.eh.actions so that we don't try to outline this lpad.
+  Function *ActionIntrin = Intrinsic::getDeclaration(Handler->getParent(),
+                                                     Intrinsic::eh_actions);
+  Builder.CreateCall(ActionIntrin, "recover");
   LPad->setCleanup(true);
   Builder.CreateUnreachable();
   return StubBB;

Modified: llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll?rev=235563&r1=235562&r2=235563&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll (original)
+++ llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll Wed Apr 22 19:20:44 2015
@@ -106,6 +106,7 @@ entry.split:
 stub:                                             ; preds = %entry
   %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
           cleanup
+  %recover = call i8* (...) @llvm.eh.actions()
   unreachable
 }
 

Modified: llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-catch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-catch.ll?rev=235563&r1=235562&r2=235563&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-catch.ll (original)
+++ llvm/trunk/test/CodeGen/WinEH/cppeh-prepared-catch.ll Wed Apr 22 19:20:44 2015
@@ -70,6 +70,7 @@ done:
 lpad:                                             ; preds = %entry
   %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
           cleanup
+  %recover = call i8* (...) @llvm.eh.actions()
   unreachable
 }
 





More information about the llvm-commits mailing list