[llvm] r335335 - [IR] Use Instruction::isBinaryOp helper instead of raw enum range tests. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 22 03:48:02 PDT 2018
Author: rksimon
Date: Fri Jun 22 03:48:02 2018
New Revision: 335335
URL: http://llvm.org/viewvc/llvm-project?rev=335335&view=rev
Log:
[IR] Use Instruction::isBinaryOp helper instead of raw enum range tests. NFCI.
Modified:
llvm/trunk/lib/IR/ConstantRange.cpp
llvm/trunk/lib/IR/Constants.cpp
Modified: llvm/trunk/lib/IR/ConstantRange.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/ConstantRange.cpp?rev=335335&r1=335334&r2=335335&view=diff
==============================================================================
--- llvm/trunk/lib/IR/ConstantRange.cpp (original)
+++ llvm/trunk/lib/IR/ConstantRange.cpp Fri Jun 22 03:48:02 2018
@@ -191,8 +191,7 @@ ConstantRange::makeGuaranteedNoWrapRegio
return CR0.inverse().unionWith(CR1.inverse()).inverse();
};
- assert(BinOp >= Instruction::BinaryOpsBegin &&
- BinOp < Instruction::BinaryOpsEnd && "Binary operators only!");
+ assert(Instruction::isBinaryOp(BinOp) && "Binary operators only!");
assert((NoWrapKind == OBO::NoSignedWrap ||
NoWrapKind == OBO::NoUnsignedWrap ||
@@ -665,8 +664,7 @@ ConstantRange ConstantRange::sextOrTrunc
ConstantRange ConstantRange::binaryOp(Instruction::BinaryOps BinOp,
const ConstantRange &Other) const {
- assert(BinOp >= Instruction::BinaryOpsBegin &&
- BinOp < Instruction::BinaryOpsEnd && "Binary operators only!");
+ assert(Instruction::isBinaryOp(BinOp) && "Binary operators only!");
switch (BinOp) {
case Instruction::Add:
Modified: llvm/trunk/lib/IR/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Constants.cpp?rev=335335&r1=335334&r2=335335&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Constants.cpp (original)
+++ llvm/trunk/lib/IR/Constants.cpp Fri Jun 22 03:48:02 2018
@@ -1773,8 +1773,7 @@ Constant *ConstantExpr::getAddrSpaceCast
Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2,
unsigned Flags, Type *OnlyIfReducedTy) {
// Check the operands for consistency first.
- assert(Opcode >= Instruction::BinaryOpsBegin &&
- Opcode < Instruction::BinaryOpsEnd &&
+ assert(Instruction::isBinaryOp(Opcode) &&
"Invalid opcode in binary constant expression");
assert(C1->getType() == C2->getType() &&
"Operand types in binary constant expression should match");
More information about the llvm-commits
mailing list