diff --git a/llvm/include/llvm/Instructions.h b/llvm/include/llvm/Instructions.h index a7fe6a0ac745..2e6b85b729b1 100644 --- a/llvm/include/llvm/Instructions.h +++ b/llvm/include/llvm/Instructions.h @@ -1219,7 +1219,11 @@ public: } /// Transparently provide more efficient getOperand methods. - Value *getOperand(unsigned i) const { + const Value *getOperand(unsigned i) const { + assert(i < 3 && "getOperand() out of range!"); + return Ops[i]; + } + Value *getOperand(unsigned i) { assert(i < 3 && "getOperand() out of range!"); return Ops[i]; }