summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Instructions.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-06-26 07:15:59 +0000
committerCraig Topper <craig.topper@gmail.com>2017-06-26 07:15:59 +0000
commit700892fd890067eb22cb9ed89c68d53d2be8251c (patch)
tree5eef9779ff21c010eda0b0011653b8142d220fc9 /llvm/lib/IR/Instructions.cpp
parent0e70206c8fc6a17a2b9b9c55aa2a7ddf982037a6 (diff)
downloadbcm5719-llvm-700892fd890067eb22cb9ed89c68d53d2be8251c.tar.gz
bcm5719-llvm-700892fd890067eb22cb9ed89c68d53d2be8251c.zip
[IR] Rename BinaryOperator::init to AssertOK and remove argument. Replace default case in switch with llvm_unreachable since all valid opcodes are covered.
This method doesn't do any initializing. It just contains asserts. So renaming to AssertOK makes it consistent with similar instructions in other Instruction classes. llvm-svn: 306277
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r--llvm/lib/IR/Instructions.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 44b6d6a99ad..a79b00be4ff 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -1995,8 +1995,8 @@ BinaryOperator::BinaryOperator(BinaryOps iType, Value *S1, Value *S2,
InsertBefore) {
Op<0>() = S1;
Op<1>() = S2;
- init(iType);
setName(Name);
+ AssertOK();
}
BinaryOperator::BinaryOperator(BinaryOps iType, Value *S1, Value *S2,
@@ -2008,17 +2008,17 @@ BinaryOperator::BinaryOperator(BinaryOps iType, Value *S1, Value *S2,
InsertAtEnd) {
Op<0>() = S1;
Op<1>() = S2;
- init(iType);
setName(Name);
+ AssertOK();
}
-void BinaryOperator::init(BinaryOps iType) {
+void BinaryOperator::AssertOK() {
Value *LHS = getOperand(0), *RHS = getOperand(1);
(void)LHS; (void)RHS; // Silence warnings.
assert(LHS->getType() == RHS->getType() &&
"Binary operator operand types must match!");
#ifndef NDEBUG
- switch (iType) {
+ switch (getOpcode()) {
case Add: case Sub:
case Mul:
assert(getType() == LHS->getType() &&
@@ -2075,8 +2075,7 @@ void BinaryOperator::init(BinaryOps iType) {
assert(getType()->isIntOrIntVectorTy() &&
"Tried to create a logical operation on a non-integral type!");
break;
- default:
- break;
+ default: llvm_unreachable("Invalid opcode provided");
}
#endif
}
OpenPOWER on IntegriCloud