Index: llvm/lib/Target/X86/X86MCInstLower.cpp =================================================================== --- llvm/lib/Target/X86/X86MCInstLower.cpp +++ llvm/lib/Target/X86/X86MCInstLower.cpp @@ -2714,9 +2714,10 @@ for (MBBI = PrevCrossBBInst(MBBI); MBBI != MachineBasicBlock::const_iterator(); MBBI = PrevCrossBBInst(MBBI)) { - // Conservatively assume that pseudo instructions don't emit code and keep - // looking for a call. We may emit an unnecessary nop in some cases. - if (!MBBI->isPseudo()) { + // Pseudo instructions that aren't a call are assumed to not emit any + // code. If they do, we worst case generate unnecessary noops after a + // call. + if (MBBI->isCall() || !MBBI->isPseudo()) { if (MBBI->isCall()) EmitAndCountInstruction(MCInstBuilder(X86::NOOP)); break; Index: llvm/test/CodeGen/X86/win64-seh-epilogue-statepoint.ll =================================================================== --- llvm/test/CodeGen/X86/win64-seh-epilogue-statepoint.ll +++ llvm/test/CodeGen/X86/win64-seh-epilogue-statepoint.ll @@ -9,6 +9,7 @@ ; CHECK-NEXT: .seh_endprologue ; CHECK-NEXT: callq bar ; CHECK-NEXT: .Ltmp0: +; CHECK-NEXT: nop ; CHECK-NEXT: addq $40, %rsp ; CHECK-NEXT: retq ; CHECK-NEXT: .seh_endproc