aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index d0dfb80..2461773 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/lib/Target/X86/X86InstrInfo.cpp
@@ -4203,19 +4203,17 @@ static MachineInstr* foldPatchpoint(MachineFunction &MF,
const SmallVectorImpl<unsigned> &Ops,
int FrameIndex,
const TargetInstrInfo &TII) {
- bool hasDef = MI->getOperand(0).isReg() && MI->getOperand(0).isDef() &&
- !MI->getOperand(0).isImplicit();
- unsigned StartIdx = hasDef ? 1 : 0;
-
+ unsigned StartIdx = 0;
switch (MI->getOpcode()) {
case TargetOpcode::STACKMAP:
- StartIdx += 2; // Skip ID, nShadowBytes.
+ StartIdx = 2; // Skip ID, nShadowBytes.
break;
- case TargetOpcode::PATCHPOINT:
- // Skip ID, numBytes, Target, numArgs.
+ case TargetOpcode::PATCHPOINT: {
// For PatchPoint, the call args are not foldable.
- StartIdx += MI->getOperand(StartIdx+3).getImm() + 4;
+ PatchPointOpers opers(MI);
+ StartIdx = opers.getVarIdx();
break;
+ }
default:
llvm_unreachable("unexpected stackmap opcode");
}