diff --git a/llvm/include/llvm/MC/MCRegisterInfo.h b/llvm/include/llvm/MC/MCRegisterInfo.h index 1deb4ef25242..ada5ae80af0c 100644 --- a/llvm/include/llvm/MC/MCRegisterInfo.h +++ b/llvm/include/llvm/MC/MCRegisterInfo.h @@ -76,7 +76,7 @@ public: bool contains(unsigned Reg) const { unsigned InByte = Reg % 8; unsigned Byte = Reg / 8; - if (Byte > RegSetSize) + if (Byte >= RegSetSize) return false; return (RegSet[Byte] & (1 << InByte)) != 0; }