Don't call getOperandConstraint() if operand index is greater than
TID->numOperands.
llvm-svn: 35375
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index 6fcbcf2..2532fa3 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -965,7 +965,8 @@
if (WasKill) {
const TargetInstrDescriptor *NTID =
NextMII->getInstrDescriptor();
- if (NTID->getOperandConstraint(UIdx, TOI::TIED_TO) == -1)
+ if (UIdx >= NTID->numOperands ||
+ NTID->getOperandConstraint(UIdx, TOI::TIED_TO) == -1)
MOU.setIsKill();
}
Spills.addLastUse(InReg, &(*NextMII));