From b69afa8e9ba51c2e136a9abc3222b8ec40cd128a Mon Sep 17 00:00:00 2001 From: Joseph Tremoulet Date: Tue, 2 Apr 2019 15:47:11 +0000 Subject: [PruneEH] Don't split musttail call from ret Summary: When inserting an `unreachable` after a noreturn call, we must ensure that it's not a musttail call to avoid breaking the IR invariants for musttail calls. Reviewers: fedor.sergeev, majnemer Reviewed By: majnemer Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60079 llvm-svn: 357483 --- llvm/lib/Transforms/IPO/PruneEH.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/IPO/PruneEH.cpp') diff --git a/llvm/lib/Transforms/IPO/PruneEH.cpp b/llvm/lib/Transforms/IPO/PruneEH.cpp index 46d42764fd2..ef7b43e8b55 100644 --- a/llvm/lib/Transforms/IPO/PruneEH.cpp +++ b/llvm/lib/Transforms/IPO/PruneEH.cpp @@ -203,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(I++)) - if (CI->doesNotReturn() && !isa(I)) { + if (CI->doesNotReturn() && !CI->isMustTailCall() && + !isa(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 -- cgit v1.2.3