summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86InstrInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index 75c6c2a755..2351cffdaa 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/lib/Target/X86/X86InstrInfo.cpp
@@ -4206,12 +4206,18 @@ static MachineInstr* foldPatchpoint(MachineFunction &MF,
MF.CreateMachineInstr(TII.get(MI->getOpcode()), MI->getDebugLoc(), true);
MachineInstrBuilder MIB(MF, NewMI);
- bool isPatchPoint = MI->getOpcode() == TargetOpcode::PATCHPOINT;
- // For PatchPoint, the call args are not foldable.
- unsigned NumCallArgs = MI->getOperand(StartIdx+3).getImm();
- StartIdx = isPatchPoint ?
- StartIdx + NumCallArgs + 5 :
- StartIdx + 2;
+ switch (MI->getOpcode()) {
+ case TargetOpcode::STACKMAP:
+ StartIdx += 2; // Skip ID, nShadowBytes.
+ break;
+ case TargetOpcode::PATCHPOINT:
+ // Skip ID, numBytes, Target, numArgs.
+ // For PatchPoint, the call args are not foldable.
+ StartIdx += MI->getOperand(StartIdx+3).getImm() + 4;
+ break;
+ default:
+ llvm_unreachable("unexpected stackmap opcode");
+ }
// Return false if any operands requested for folding are not foldable (not
// part of the stackmap's live values).