diff options
Diffstat (limited to 'lib/Transforms/IPO/PruneEH.cpp')
-rw-r--r-- | lib/Transforms/IPO/PruneEH.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp index ae586c017471..cb3915dfb678 100644 --- a/lib/Transforms/IPO/PruneEH.cpp +++ b/lib/Transforms/IPO/PruneEH.cpp @@ -1,9 +1,8 @@ //===- PruneEH.cpp - Pass which deletes unused exception handlers ---------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -204,7 +203,8 @@ static bool SimplifyFunction(Function *F, CallGraph &CG) { for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) if (CallInst *CI = dyn_cast<CallInst>(I++)) - if (CI->doesNotReturn() && !isa<UnreachableInst>(I)) { + if (CI->doesNotReturn() && !CI->isMustTailCall() && + !isa<UnreachableInst>(I)) { // This call calls a function that cannot return. Insert an // unreachable instruction after it and simplify the code. Do this // by splitting the BB, adding the unreachable, then deleting the @@ -242,12 +242,12 @@ static void DeleteBasicBlock(BasicBlock *BB, CallGraph &CG) { break; } - if (auto CS = CallSite (&*I)) { - const Function *Callee = CS.getCalledFunction(); + if (auto *Call = dyn_cast<CallBase>(&*I)) { + const Function *Callee = Call->getCalledFunction(); if (!Callee || !Intrinsic::isLeaf(Callee->getIntrinsicID())) - CGN->removeCallEdgeFor(CS); + CGN->removeCallEdgeFor(*Call); else if (!Callee->isIntrinsic()) - CGN->removeCallEdgeFor(CS); + CGN->removeCallEdgeFor(*Call); } if (!I->use_empty()) |