Fix a use-after-free bug introduced in r262636
llvm-svn: 262679
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 923e5b2..251afb5 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1994,8 +1994,11 @@
// If we inlined any musttail calls and the original return is now
// unreachable, delete it. It can only contain a bitcast and ret.
- if (InlinedMustTailCalls && pred_begin(AfterCallBB) == pred_end(AfterCallBB))
+ if (InlinedMustTailCalls &&
+ pred_begin(AfterCallBB) == pred_end(AfterCallBB)) {
+ IFI.CallSuccessorBlockDeleted = true;
AfterCallBB->eraseFromParent();
+ }
// We should always be able to fold the entry block of the function into the
// single predecessor of the block...