Silly assertion. Forgot variable_ops instructions can have arbitrary number of
authorEvan Cheng <evan.cheng@apple.com>
Fri, 15 Dec 2006 06:37:08 +0000 (06:37 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 15 Dec 2006 06:37:08 +0000 (06:37 +0000)
operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32592 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetInstrInfo.h

index 7fb594d1c9a52e958c449fcf02975f40cd0bcdf5..eb1dbce352a3a6596123f79bf240c286131041a2 100644 (file)
@@ -132,8 +132,10 @@ public:
   /// it is set. Returns -1 if it is not set.
   int getOperandConstraint(unsigned OpNum,
                            TOI::OperandConstraint Constraint) const {
-    assert(OpNum < numOperands && "Invalid operand # of TargetInstrInfo");
-    if (OpInfo[OpNum].Constraints & (1 << Constraint)) {
+    assert((OpNum < numOperands || (Flags & M_VARIABLE_OPS)) &&
+           "Invalid operand # of TargetInstrInfo");
+    if (OpNum < numOperands &&
+        (OpInfo[OpNum].Constraints & (1 << Constraint))) {
       unsigned Pos = 16 + Constraint * 4;
       return (int)(OpInfo[OpNum].Constraints >> Pos) & 0xf;
     }