summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-06-22 10:48:02 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-06-22 10:48:02 +0000
commite0a6eb1f4f3459a162d23377b421dba545f8fd43 (patch)
tree8bf79ecd629c75845d6d5244676ca4c957c29ae5 /llvm/lib
parent7ad1696900e6189f89688a346f6d954372748a33 (diff)
downloadbcm5719-llvm-e0a6eb1f4f3459a162d23377b421dba545f8fd43.tar.gz
bcm5719-llvm-e0a6eb1f4f3459a162d23377b421dba545f8fd43.zip
[IR] Use Instruction::isBinaryOp helper instead of raw enum range tests. NFCI.
llvm-svn: 335335
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/ConstantRange.cpp6
-rw-r--r--llvm/lib/IR/Constants.cpp3
2 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp
index bd65aede940..157473f84f2 100644
--- a/llvm/lib/IR/ConstantRange.cpp
+++ b/llvm/lib/IR/ConstantRange.cpp
@@ -191,8 +191,7 @@ ConstantRange::makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp,
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(uint32_t DstTySize) const {
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:
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index e7752758361..5ec0834c77d 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -1773,8 +1773,7 @@ Constant *ConstantExpr::getAddrSpaceCast(Constant *C, Type *DstTy,
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");
OpenPOWER on IntegriCloud