[llvm-branch-commits] [llvm-branch] r261132 - Merging r258616:

David Majnemer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 17 10:49:29 PST 2016


Author: majnemer
Date: Wed Feb 17 12:49:28 2016
New Revision: 261132

URL: http://llvm.org/viewvc/llvm-project?rev=261132&view=rev
Log:
Merging r258616:
------------------------------------------------------------------------
r258616 | majnemer | 2016-01-22 22:00:44 -0800 (Fri, 22 Jan 2016) | 3 lines

[PruneEH] Don't try to insert a terminator after another terminator

LLVM's BasicBlock has a single terminator, it is not valid to have two.
------------------------------------------------------------------------

Modified:
    llvm/branches/release_38/   (props changed)
    llvm/branches/release_38/lib/Transforms/IPO/PruneEH.cpp
    llvm/branches/release_38/test/Transforms/PruneEH/pr26263.ll

Propchange: llvm/branches/release_38/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 17 12:49:28 2016
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,257645,257648,257730,257775,257791,257864,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258103,258112,258168,258184,258207,258221,258273,258325,258406,258416,258428,258436,258471,258609-258611,258690,258729,258891,258971,259177-259178,259228,259236,259342,259346,259375,259381,259645,259649,259695-259696,259702,259740,259798,259835,259840,259886,259888,259958,260164,260390,260427,260587,260641,260703,260733,261033
+/llvm/trunk:155241,257645,257648,257730,257775,257791,257864,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258103,258112,258168,258184,258207,258221,258273,258325,258406,258416,258428,258436,258471,258609-258611,258616,258690,258729,258891,258971,259177-259178,259228,259236,259342,259346,259375,259381,259645,259649,259695-259696,259702,259740,259798,259835,259840,259886,259888,259958,260164,260390,260427,260587,260641,260703,260733,261033

Modified: llvm/branches/release_38/lib/Transforms/IPO/PruneEH.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/lib/Transforms/IPO/PruneEH.cpp?rev=261132&r1=261131&r2=261132&view=diff
==============================================================================
--- llvm/branches/release_38/lib/Transforms/IPO/PruneEH.cpp (original)
+++ llvm/branches/release_38/lib/Transforms/IPO/PruneEH.cpp Wed Feb 17 12:49:28 2016
@@ -252,7 +252,8 @@ void PruneEH::DeleteBasicBlock(BasicBloc
   }
 
   if (TokenInst) {
-    changeToUnreachable(TokenInst->getNextNode(), /*UseLLVMTrap=*/false);
+    if (!isa<TerminatorInst>(TokenInst))
+      changeToUnreachable(TokenInst->getNextNode(), /*UseLLVMTrap=*/false);
   } else {
     // Get the list of successors of this block.
     std::vector<BasicBlock *> Succs(succ_begin(BB), succ_end(BB));

Modified: llvm/branches/release_38/test/Transforms/PruneEH/pr26263.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/test/Transforms/PruneEH/pr26263.ll?rev=261132&r1=261131&r2=261132&view=diff
==============================================================================
--- llvm/branches/release_38/test/Transforms/PruneEH/pr26263.ll (original)
+++ llvm/branches/release_38/test/Transforms/PruneEH/pr26263.ll Wed Feb 17 12:49:28 2016
@@ -27,4 +27,30 @@ cleanupret:
 
 ; CHECK: cleanupret from %[[cp]] unwind to caller
 
+define void @test2() personality i32 (...)* @__CxxFrameHandler3 {
+  invoke void @neverthrows()
+          to label %try.cont unwind label %catchswitch
+
+try.cont:
+  ret void
+
+catchswitch:
+  %cs = catchswitch within none [label %catchpad] unwind to caller
+
+catchpad:
+  %cp = catchpad within %cs []
+  unreachable
+
+ret:
+  ret void
+}
+
+; CHECK-LABEL: define void @test2(
+; CHECK: call void @neverthrows()
+
+; CHECK: %[[cs:.*]] = catchswitch within none [label
+
+; CHECK: catchpad within %[[cs]] []
+; CHECK-NEXT: unreachable
+
 declare i32 @__CxxFrameHandler3(...)




More information about the llvm-branch-commits mailing list