From: Serge Guelton Date: Mon, 13 Nov 2017 21:55:01 +0000 (+0000) Subject: Fix -Werror when compiling rL318083 (ter) X-Git-Tag: android-x86-7.1-r4~8600 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f3d06a209d55b1c67b30847a125283377b9fe5b2;p=android-x86%2Fexternal-llvm.git Fix -Werror when compiling rL318083 (ter) 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@318091 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/IR/Value.cpp b/lib/IR/Value.cpp index 5df0c6d81cf..bfd39114b3f 100644 --- a/lib/IR/Value.cpp +++ b/lib/IR/Value.cpp @@ -50,6 +50,7 @@ Value::Value(Type *ty, unsigned scid) : VTy(checkType(ty)), UseList(nullptr), SubclassID(scid), HasValueHandle(0), SubclassOptionalData(0), SubclassData(0), NumUserOperands(0), IsUsedByMD(false), HasName(false) { + static_assert(ConstantFirstVal == 0, "!(SubclassID < ConstantFirstVal)"); // FIXME: Why isn't this in the subclass gunk?? // Note, we cannot call isa before the CallInst has been // constructed. @@ -57,7 +58,7 @@ Value::Value(Type *ty, unsigned scid) assert((VTy->isFirstClassType() || VTy->isVoidTy() || VTy->isStructTy()) && "invalid CallInst type!"); else if (SubclassID != BasicBlockVal && - (SubclassID < ConstantFirstVal || SubclassID > ConstantLastVal)) + (/*SubclassID < ConstantFirstVal ||*/ SubclassID > ConstantLastVal)) assert((VTy->isFirstClassType() || VTy->isVoidTy()) && "Cannot create non-first-class values except for constants!"); static_assert(sizeof(Value) == 2 * sizeof(void *) + 2 * sizeof(unsigned),