[llvm] r306250 - [IR] Use isIntOrIntVectorTy instead of writing it out the long way. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 25 10:33:48 PDT 2017


Author: ctopper
Date: Sun Jun 25 10:33:48 2017
New Revision: 306250

URL: http://llvm.org/viewvc/llvm-project?rev=306250&view=rev
Log:
[IR] Use isIntOrIntVectorTy instead of writing it out the long way. NFC

Modified:
    llvm/trunk/lib/IR/Instructions.cpp

Modified: llvm/trunk/lib/IR/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Instructions.cpp?rev=306250&r1=306249&r2=306250&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Instructions.cpp (original)
+++ llvm/trunk/lib/IR/Instructions.cpp Sun Jun 25 10:33:48 2017
@@ -2038,8 +2038,7 @@ void BinaryOperator::init(BinaryOps iTyp
   case SDiv: 
     assert(getType() == LHS->getType() &&
            "Arithmetic operation should return same type as operands!");
-    assert((getType()->isIntegerTy() || (getType()->isVectorTy() && 
-            cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
+    assert(getType()->isIntOrIntVectorTy() &&
            "Incorrect operand type (not integer) for S/UDIV");
     break;
   case FDiv:
@@ -2052,8 +2051,7 @@ void BinaryOperator::init(BinaryOps iTyp
   case SRem: 
     assert(getType() == LHS->getType() &&
            "Arithmetic operation should return same type as operands!");
-    assert((getType()->isIntegerTy() || (getType()->isVectorTy() && 
-            cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
+    assert(getType()->isIntOrIntVectorTy() &&
            "Incorrect operand type (not integer) for S/UREM");
     break;
   case FRem:
@@ -2067,18 +2065,14 @@ void BinaryOperator::init(BinaryOps iTyp
   case AShr:
     assert(getType() == LHS->getType() &&
            "Shift operation should return same type as operands!");
-    assert((getType()->isIntegerTy() ||
-            (getType()->isVectorTy() && 
-             cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
+    assert(getType()->isIntOrIntVectorTy() &&
            "Tried to create a shift operation on a non-integral type!");
     break;
   case And: case Or:
   case Xor:
     assert(getType() == LHS->getType() &&
            "Logical operation should return same type as operands!");
-    assert((getType()->isIntegerTy() ||
-            (getType()->isVectorTy() && 
-             cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
+    assert(getType()->isIntOrIntVectorTy() &&
            "Tried to create a logical operation on a non-integral type!");
     break;
   default:




More information about the llvm-commits mailing list