OSDN Git Service

Fix -Werror when compiling rL318083 (bis)
authorSerge Guelton <sguelton@quarkslab.com>
Mon, 13 Nov 2017 21:40:57 +0000 (21:40 +0000)
committerSerge Guelton <sguelton@quarkslab.com>
Mon, 13 Nov 2017 21:40:57 +0000 (21:40 +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@318090 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Value.h

index f50f017..60a64c8 100644 (file)
@@ -762,8 +762,8 @@ template <class Compare> void Value::sortUseList(Compare Cmp) {
 //
 template <> struct isa_impl<Constant, Value> {
   static inline bool doit(const Value &Val) {
-    return Val.getValueID() >= Value::ConstantFirstVal &&
-      Val.getValueID() <= Value::ConstantLastVal;
+    static_assert(Value::ConstantFirstVal == 0, "Val.getValueID() >= Value::ConstantFirstVal");
+    return Val.getValueID() <= Value::ConstantLastVal;
   }
 };