[PATCH] D60079: [PruneEH] Don't split musttail call from ret
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 2 08:45:54 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL357483: [PruneEH] Don't split musttail call from ret (authored by josepht, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D60079?vs=193133&id=193301#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60079/new/
https://reviews.llvm.org/D60079
Files:
llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
llvm/trunk/test/Transforms/PruneEH/musttail.ll
Index: llvm/trunk/test/Transforms/PruneEH/musttail.ll
===================================================================
--- llvm/trunk/test/Transforms/PruneEH/musttail.ll
+++ llvm/trunk/test/Transforms/PruneEH/musttail.ll
@@ -0,0 +1,15 @@
+; RUN: opt -prune-eh -S < %s | FileCheck %s
+
+declare void @noreturn()
+
+define void @testfn() {
+ ; A musttail call must be followed by (optional bitcast then) ret,
+ ; so make sure we don't insert an unreachable
+ ; CHECK: musttail call void @noreturn
+ ; CHECK-NOT: unreachable
+ ; CHECK-NEXT: ret void
+ musttail call void @noreturn() #0
+ ret void
+}
+
+attributes #0 = { noreturn }
Index: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
+++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
@@ -203,7 +203,8 @@
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60079.193301.patch
Type: text/x-patch
Size: 1402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190402/d3171163/attachment.bin>
More information about the llvm-commits
mailing list