[llvm] r307210 - [IR] Use CmpInst::isIntPredicate()/isFPPredicate in some asserts instead of doing the equivalent range check. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 15:09:00 PDT 2017


Author: ctopper
Date: Wed Jul  5 15:09:00 2017
New Revision: 307210

URL: http://llvm.org/viewvc/llvm-project?rev=307210&view=rev
Log:
[IR] Use CmpInst::isIntPredicate()/isFPPredicate in some asserts instead of doing the equivalent range check. NFC

Modified:
    llvm/trunk/include/llvm/IR/Instructions.h

Modified: llvm/trunk/include/llvm/IR/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Instructions.h?rev=307210&r1=307209&r2=307210&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Instructions.h (original)
+++ llvm/trunk/include/llvm/IR/Instructions.h Wed Jul  5 15:09:00 2017
@@ -1101,8 +1101,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(Get
 /// Represent an integer comparison operator.
 class ICmpInst: public CmpInst {
   void AssertOK() {
-    assert(getPredicate() >= CmpInst::FIRST_ICMP_PREDICATE &&
-           getPredicate() <= CmpInst::LAST_ICMP_PREDICATE &&
+    assert(isIntPredicate() &&
            "Invalid ICmp predicate value");
     assert(getOperand(0)->getType() == getOperand(1)->getType() &&
           "Both operands to ICmp instruction are not of the same type!");
@@ -1244,8 +1243,7 @@ public:
 /// Represents a floating point comparison operator.
 class FCmpInst: public CmpInst {
   void AssertOK() {
-    assert(getPredicate() <= FCmpInst::LAST_FCMP_PREDICATE &&
-           "Invalid FCmp predicate value");
+    assert(isFPPredicate() && "Invalid FCmp predicate value");
     assert(getOperand(0)->getType() == getOperand(1)->getType() &&
            "Both operands to FCmp instruction are not of the same type!");
     // Check that the operands are the right type




More information about the llvm-commits mailing list