[llvm-branch-commits] [llvm-branch] r261131 - Merging r258611:

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


Author: majnemer
Date: Wed Feb 17 12:49:09 2016
New Revision: 261131

URL: http://llvm.org/viewvc/llvm-project?rev=261131&view=rev
Log:
Merging r258611:
------------------------------------------------------------------------
r258611 | majnemer | 2016-01-22 21:41:29 -0800 (Fri, 22 Jan 2016) | 6 lines

[PruneEH] FuncletPads must not have undef operands

Instead of RAUW with undef, replace the first non-token instruction with
unreachable.

This fixes PR26263.
------------------------------------------------------------------------

Added:
    llvm/branches/release_38/test/Transforms/PruneEH/pr26263.ll
      - copied unchanged from r258611, llvm/trunk/test/Transforms/PruneEH/pr26263.ll
Modified:
    llvm/branches/release_38/   (props changed)
    llvm/branches/release_38/lib/Transforms/IPO/PruneEH.cpp

Propchange: llvm/branches/release_38/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 17 12:49:09 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-258610,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,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=261131&r1=261130&r2=261131&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:09 2016
@@ -228,10 +228,17 @@ void PruneEH::DeleteBasicBlock(BasicBloc
   assert(pred_empty(BB) && "BB is not dead!");
   CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();
 
+  Instruction *TokenInst = nullptr;
+
   CallGraphNode *CGN = CG[BB->getParent()];
   for (BasicBlock::iterator I = BB->end(), E = BB->begin(); I != E; ) {
     --I;
 
+    if (I->getType()->isTokenTy()) {
+      TokenInst = &*I;
+      break;
+    }
+
     if (auto CS = CallSite (&*I)) {
       const Function *Callee = CS.getCalledFunction();
       if (!Callee || !Intrinsic::isLeaf(Callee->getIntrinsicID()))
@@ -244,11 +251,15 @@ void PruneEH::DeleteBasicBlock(BasicBloc
       I->replaceAllUsesWith(UndefValue::get(I->getType()));
   }
 
-  // Get the list of successors of this block.
-  std::vector<BasicBlock*> Succs(succ_begin(BB), succ_end(BB));
+  if (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));
 
-  for (unsigned i = 0, e = Succs.size(); i != e; ++i)
-    Succs[i]->removePredecessor(BB);
+    for (unsigned i = 0, e = Succs.size(); i != e; ++i)
+      Succs[i]->removePredecessor(BB);
 
-  BB->eraseFromParent();
+    BB->eraseFromParent();
+  }
 }




More information about the llvm-branch-commits mailing list