summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/X86/X86WinEHState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/X86/X86WinEHState.cpp')
-rw-r--r--llvm/lib/Target/X86/X86WinEHState.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86WinEHState.cpp b/llvm/lib/Target/X86/X86WinEHState.cpp
index b3e4c70eb57f..35b7d7f508b0 100644
--- a/llvm/lib/Target/X86/X86WinEHState.cpp
+++ b/llvm/lib/Target/X86/X86WinEHState.cpp
@@ -363,6 +363,11 @@ void WinEHStatePass::emitExceptionRegistrationRecord(Function *F) {
Instruction *T = BB.getTerminator();
if (!isa<ReturnInst>(T))
continue;
+
+ // If there is a musttail call, that's the de-facto terminator.
+ if (CallInst *CI = BB.getTerminatingMustTailCall())
+ T = CI;
+
Builder.SetInsertPoint(T);
unlinkExceptionRegistration(Builder);
}