summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86MCInstLower.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/X86/X86MCInstLower.cpp')
-rw-r--r--llvm/lib/Target/X86/X86MCInstLower.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index 55f0420a928..38d4b1aa647 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -1929,6 +1929,20 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
return;
}
+ case X86::SEH_NoReturn: {
+ // Materialize an int3 if this instruction is in the last basic block in the
+ // function. The int3 serves the same purpose as the noop emitted above for
+ // SEH_Epilogue, which is to make the Win64 unwinder happy. If the return
+ // address of the preceding call appears to precede an epilogue or a new
+ // function, then the unwinder may get lost.
+ const MachineBasicBlock *MBB = MI->getParent();
+ const MachineBasicBlock *NextMBB = MBB->getNextNode();
+ if (!NextMBB || NextMBB->isEHPad()) {
+ EmitAndCountInstruction(MCInstBuilder(X86::INT3));
+ }
+ return;
+ }
+
// Lower PSHUFB and VPERMILP normally but add a comment if we can find
// a constant shuffle mask. We won't be able to do this at the MC layer
// because the mask isn't an immediate.
OpenPOWER on IntegriCloud