[llvm-commits] [llvm] r73433 - in /llvm/trunk/lib/VMCore: Constants.cpp Instructions.cpp
Dan Gohman
gohman at apple.com
Mon Jun 15 15:25:13 PDT 2009
Author: djg
Date: Mon Jun 15 17:25:12 2009
New Revision: 73433
URL: http://llvm.org/viewvc/llvm-project?rev=73433&view=rev
Log:
Use Type::isIntOrIntVector and Type::isFPOrFPVector.
Modified:
llvm/trunk/lib/VMCore/Constants.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=73433&r1=73432&r2=73433&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Mon Jun 15 17:25:12 2009
@@ -2246,34 +2246,30 @@
case Instruction::UDiv:
case Instruction::SDiv:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
- assert((C1->getType()->isInteger() || (isa<VectorType>(C1->getType()) &&
- cast<VectorType>(C1->getType())->getElementType()->isInteger())) &&
+ assert(C1->getType()->isIntOrIntVector() &&
"Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case Instruction::FDiv:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
- assert((C1->getType()->isFloatingPoint() || (isa<VectorType>(C1->getType())
- && cast<VectorType>(C1->getType())->getElementType()->isFloatingPoint()))
- && "Tried to create an arithmetic operation on a non-arithmetic type!");
+ assert(C1->getType()->isFPOrFPVector() &&
+ "Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case Instruction::URem:
case Instruction::SRem:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
- assert((C1->getType()->isInteger() || (isa<VectorType>(C1->getType()) &&
- cast<VectorType>(C1->getType())->getElementType()->isInteger())) &&
+ assert(C1->getType()->isIntOrIntVector() &&
"Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case Instruction::FRem:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
- assert((C1->getType()->isFloatingPoint() || (isa<VectorType>(C1->getType())
- && cast<VectorType>(C1->getType())->getElementType()->isFloatingPoint()))
- && "Tried to create an arithmetic operation on a non-arithmetic type!");
+ assert(C1->getType()->isFPOrFPVector() &&
+ "Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case Instruction::And:
case Instruction::Or:
case Instruction::Xor:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
- assert((C1->getType()->isInteger() || isa<VectorType>(C1->getType())) &&
+ assert(C1->getType()->isIntOrIntVector() &&
"Tried to create a logical operation on a non-integral type!");
break;
case Instruction::Shl:
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=73433&r1=73432&r2=73433&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Jun 15 17:25:12 2009
@@ -1576,9 +1576,8 @@
case FDiv:
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
- assert((getType()->isFloatingPoint() || (isa<VectorType>(getType()) &&
- cast<VectorType>(getType())->getElementType()->isFloatingPoint()))
- && "Incorrect operand type (not floating point) for FDIV");
+ assert(getType()->isFPOrFPVector() &&
+ "Incorrect operand type (not floating point) for FDIV");
break;
case URem:
case SRem:
@@ -1591,9 +1590,8 @@
case FRem:
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
- assert((getType()->isFloatingPoint() || (isa<VectorType>(getType()) &&
- cast<VectorType>(getType())->getElementType()->isFloatingPoint()))
- && "Incorrect operand type (not floating point) for FREM");
+ assert(getType()->isFPOrFPVector() &&
+ "Incorrect operand type (not floating point) for FREM");
break;
case Shl:
case LShr:
@@ -2137,7 +2135,8 @@
CastInst *CastInst::CreateIntegerCast(Value *C, const Type *Ty,
bool isSigned, const std::string &Name,
BasicBlock *InsertAtEnd) {
- assert(C->getType()->isInteger() && Ty->isInteger() && "Invalid cast");
+ assert(C->getType()->isIntOrIntVector() && Ty->isIntOrIntVector() &&
+ "Invalid cast");
unsigned SrcBits = C->getType()->getScalarSizeInBits();
unsigned DstBits = Ty->getScalarSizeInBits();
Instruction::CastOps opcode =
@@ -2150,7 +2149,7 @@
CastInst *CastInst::CreateFPCast(Value *C, const Type *Ty,
const std::string &Name,
Instruction *InsertBefore) {
- assert(C->getType()->isFloatingPoint() && Ty->isFloatingPoint() &&
+ assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
"Invalid cast");
unsigned SrcBits = C->getType()->getScalarSizeInBits();
unsigned DstBits = Ty->getScalarSizeInBits();
@@ -2163,7 +2162,7 @@
CastInst *CastInst::CreateFPCast(Value *C, const Type *Ty,
const std::string &Name,
BasicBlock *InsertAtEnd) {
- assert(C->getType()->isFloatingPoint() && Ty->isFloatingPoint() &&
+ assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
"Invalid cast");
unsigned SrcBits = C->getType()->getScalarSizeInBits();
unsigned DstBits = Ty->getScalarSizeInBits();
More information about the llvm-commits
mailing list