OSDN Git Service

Fix -Werror when compiling rL318083
authorSerge Guelton <sguelton@quarkslab.com>
Mon, 13 Nov 2017 21:25:35 +0000 (21:25 +0000)
committerSerge Guelton <sguelton@quarkslab.com>
Mon, 13 Nov 2017 21:25:35 +0000 (21:25 +0000)
Statically assert the result and remove a runtime comparison, a direct consequence of the optimization introduced in rL318083.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318087 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Constant.h

index 9daeac6..0c94b58 100644 (file)
@@ -117,8 +117,8 @@ public:
 
   //// Methods for support type inquiry through isa, cast, and dyn_cast:
   static bool classof(const Value *V) {
-    return V->getValueID() >= ConstantFirstVal &&
-           V->getValueID() <= ConstantLastVal;
+    static_assert(ConstantFirstVal == 0, "V->getValueID() >= ConstantFirstVal always succeeds");
+    return V->getValueID() <= ConstantLastVal;
   }
 
   /// This method is a special form of User::replaceUsesOfWith