From ccce8bae14a8539e7c9e8d694e2126dd30dc774f Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 5 Jan 2010 13:12:22 +0000 Subject: Avoid going through the LLVMContext for type equality where it's safe to dereference the type pointer. llvm-svn: 92726 --- llvm/lib/VMCore/Value.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'llvm/lib/VMCore/Value.cpp') diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp index cc9c066f38a..ecf2d4b7744 100644 --- a/llvm/lib/VMCore/Value.cpp +++ b/llvm/lib/VMCore/Value.cpp @@ -44,14 +44,12 @@ Value::Value(const Type *ty, unsigned scid) SubclassOptionalData(0), SubclassData(0), VTy(checkType(ty)), UseList(0), Name(0) { if (isa(this) || isa(this)) - assert((VTy->isFirstClassType() || - VTy == Type::getVoidTy(ty->getContext()) || + assert((VTy->isFirstClassType() || VTy->isVoidTy() || isa(ty) || VTy->getTypeID() == Type::StructTyID) && "invalid CallInst type!"); else if (!isa(this) && !isa(this)) - assert((VTy->isFirstClassType() || - VTy == Type::getVoidTy(ty->getContext()) || - isa(ty)) && + assert((VTy->isFirstClassType() || VTy->isVoidTy() || + isa(ty)) && "Cannot create non-first-class values except for constants!"); } @@ -181,8 +179,7 @@ void Value::setName(const Twine &NewName) { if (getName() == StringRef(NameStr, NameLen)) return; - assert(getType() != Type::getVoidTy(getContext()) && - "Cannot assign a name to void values!"); + assert(!getType()->isVoidTy() && "Cannot assign a name to void values!"); // Get the symbol table to update for this object. ValueSymbolTable *ST; -- cgit v1.2.3