diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index 304d9226146..1a6d5ca829d 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -4207,10 +4207,6 @@ static MachineInstr* foldPatchpoint(MachineFunction &MF, !MI->getOperand(0).isImplicit(); unsigned StartIdx = hasDef ? 1 : 0; - MachineInstr *NewMI = - MF.CreateMachineInstr(TII.get(MI->getOpcode()), MI->getDebugLoc(), true); - MachineInstrBuilder MIB(MF, NewMI); - switch (MI->getOpcode()) { case TargetOpcode::STACKMAP: StartIdx += 2; // Skip ID, nShadowBytes. @@ -4231,6 +4227,11 @@ static MachineInstr* foldPatchpoint(MachineFunction &MF, if (*I < StartIdx) return 0; } + + MachineInstr *NewMI = + MF.CreateMachineInstr(TII.get(MI->getOpcode()), MI->getDebugLoc(), true); + MachineInstrBuilder MIB(MF, NewMI); + // No need to fold return, the meta data, and function arguments for (unsigned i = 0; i < StartIdx; ++i) MIB.addOperand(MI->getOperand(i));