Stackmap shadows should consider call returns a branch target.
[oota-llvm.git] / lib / Target / X86 / X86MCInstLower.cpp
index fc3662e6bec43d0896e612faad5f29b0c9453c0d..85cf5144f0cc853e57604171785f34b17a619162 100644 (file)
@@ -1210,4 +1210,10 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
   MCInst TmpInst;
   MCInstLowering.Lower(MI, TmpInst);
   EmitAndCountInstruction(TmpInst);
+
+  // Stackmap shadows cannot include branch targets, so we can count the bytes
+  // in a call towards the shadow, but must flush the shadow immediately after
+  // to account for the return from the call.
+  if (MI->isCall())
+    SMShadowTracker.emitShadowPadding(OutStreamer, getSubtargetInfo());
 }