forked from OSchip/llvm-project
[IR] Use Instruction::isBinaryOp helper instead of raw enum range tests. NFCI.
llvm-svn: 335335
This commit is contained in:
parent
7ad1696900
commit
e0a6eb1f4f
|
@ -191,8 +191,7 @@ ConstantRange::makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp,
|
||||||
return CR0.inverse().unionWith(CR1.inverse()).inverse();
|
return CR0.inverse().unionWith(CR1.inverse()).inverse();
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(BinOp >= Instruction::BinaryOpsBegin &&
|
assert(Instruction::isBinaryOp(BinOp) && "Binary operators only!");
|
||||||
BinOp < Instruction::BinaryOpsEnd && "Binary operators only!");
|
|
||||||
|
|
||||||
assert((NoWrapKind == OBO::NoSignedWrap ||
|
assert((NoWrapKind == OBO::NoSignedWrap ||
|
||||||
NoWrapKind == OBO::NoUnsignedWrap ||
|
NoWrapKind == OBO::NoUnsignedWrap ||
|
||||||
|
@ -665,8 +664,7 @@ ConstantRange ConstantRange::sextOrTrunc(uint32_t DstTySize) const {
|
||||||
|
|
||||||
ConstantRange ConstantRange::binaryOp(Instruction::BinaryOps BinOp,
|
ConstantRange ConstantRange::binaryOp(Instruction::BinaryOps BinOp,
|
||||||
const ConstantRange &Other) const {
|
const ConstantRange &Other) const {
|
||||||
assert(BinOp >= Instruction::BinaryOpsBegin &&
|
assert(Instruction::isBinaryOp(BinOp) && "Binary operators only!");
|
||||||
BinOp < Instruction::BinaryOpsEnd && "Binary operators only!");
|
|
||||||
|
|
||||||
switch (BinOp) {
|
switch (BinOp) {
|
||||||
case Instruction::Add:
|
case Instruction::Add:
|
||||||
|
|
|
@ -1773,8 +1773,7 @@ Constant *ConstantExpr::getAddrSpaceCast(Constant *C, Type *DstTy,
|
||||||
Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2,
|
Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2,
|
||||||
unsigned Flags, Type *OnlyIfReducedTy) {
|
unsigned Flags, Type *OnlyIfReducedTy) {
|
||||||
// Check the operands for consistency first.
|
// Check the operands for consistency first.
|
||||||
assert(Opcode >= Instruction::BinaryOpsBegin &&
|
assert(Instruction::isBinaryOp(Opcode) &&
|
||||||
Opcode < Instruction::BinaryOpsEnd &&
|
|
||||||
"Invalid opcode in binary constant expression");
|
"Invalid opcode in binary constant expression");
|
||||||
assert(C1->getType() == C2->getType() &&
|
assert(C1->getType() == C2->getType() &&
|
||||||
"Operand types in binary constant expression should match");
|
"Operand types in binary constant expression should match");
|
||||||
|
|
Loading…
Reference in New Issue