[llvm] r318091 - Fix -Werror when compiling rL318083 (ter)
Serge Guelton via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 13 13:55:01 PST 2017
Author: serge_sans_paille
Date: Mon Nov 13 13:55:01 2017
New Revision: 318091
URL: http://llvm.org/viewvc/llvm-project?rev=318091&view=rev
Log:
Fix -Werror when compiling rL318083 (ter)
Statically assert the result and remove a runtime comparison, a direct consequence of the optimization introduced in rL318083.
Modified:
llvm/trunk/lib/IR/Value.cpp
Modified: llvm/trunk/lib/IR/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Value.cpp?rev=318091&r1=318090&r2=318091&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Value.cpp (original)
+++ llvm/trunk/lib/IR/Value.cpp Mon Nov 13 13:55:01 2017
@@ -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<CallInst> 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),
More information about the llvm-commits
mailing list