[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Reid Spencer
rspencer at reidspencer.com
Sun Jan 14 17:05:49 PST 2007
On Sun, 2007-01-14 at 18:46 -0600, Chris Lattner wrote:
>
> Changes in directory llvm/lib/VMCore:
>
> Constants.cpp updated: 1.199 -> 1.200
> ---
> Log message:
>
> don't discriminate against i1
Not quite right, see below.
>
>
> ---
> Diffs of the changes: (+9 -9)
>
> Constants.cpp | 18 +++++++++---------
> 1 files changed, 9 insertions(+), 9 deletions(-)
>
>
> Index: llvm/lib/VMCore/Constants.cpp
> diff -u llvm/lib/VMCore/Constants.cpp:1.199 llvm/lib/VMCore/Constants.cpp:1.200
> --- llvm/lib/VMCore/Constants.cpp:1.199 Fri Jan 12 16:39:14 2007
> +++ llvm/lib/VMCore/Constants.cpp Sun Jan 14 18:45:50 2007
> @@ -1495,7 +1495,7 @@
> }
>
> Constant *ConstantExpr::getTrunc(Constant *C, const Type *Ty) {
> - assert(C->getType()->isInteger() && "Trunc operand must be integer");
> + assert(C->getType()->isIntegral() && "Trunc operand must be integer");
This makes no sense. How can you trunc i1 to something smaller? The
rules for trunc are SrcSize > DestSize. If SrcSize is 1 bit, what size
is Dest? 0?
> assert(Ty->isIntegral() && "Trunc produces only integral");
> assert(C->getType()->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits()&&
> "SrcTy must be larger than DestTy for Trunc!");
> @@ -1505,7 +1505,7 @@
>
> Constant *ConstantExpr::getSExt(Constant *C, const Type *Ty) {
> assert(C->getType()->isIntegral() && "SEXt operand must be integral");
> - assert(Ty->isInteger() && "SExt produces only integer");
> + assert(Ty->isIntegral() && "SExt produces only integer");
This also makes no sense. The destination type cannot be i1. Rules for
SExt are that
SrcSize < DestSize. If DestSize is 1 bit, what could SrcSize be? 0?
> assert(C->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()&&
> "SrcTy must be smaller than DestTy for SExt!");
>
> @@ -1514,7 +1514,7 @@
>
> Constant *ConstantExpr::getZExt(Constant *C, const Type *Ty) {
> assert(C->getType()->isIntegral() && "ZEXt operand must be integral");
> - assert(Ty->isInteger() && "ZExt produces only integer");
> + assert(Ty->isIntegral() && "ZExt produces only integer");
Same issue as for SExt.
> assert(C->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()&&
> "SrcTy must be smaller than DestTy for ZExt!");
>
> @@ -1649,15 +1649,15 @@
> case Instruction::Sub:
> case Instruction::Mul:
> assert(C1->getType() == C2->getType() && "Op types should be identical!");
> - assert((C1->getType()->isInteger() || C1->getType()->isFloatingPoint() ||
> + assert((C1->getType()->isIntegral() || C1->getType()->isFloatingPoint() ||
This I was going to talk to you about. This will fix the current CEE
problem, assuming it applies to Instruction::Add as well.
> isa<PackedType>(C1->getType())) &&
> "Tried to create an arithmetic operation on a non-arithmetic type!");
> break;
> case Instruction::UDiv:
> case Instruction::SDiv:
> assert(C1->getType() == C2->getType() && "Op types should be identical!");
> - assert((C1->getType()->isInteger() || (isa<PackedType>(C1->getType()) &&
> - cast<PackedType>(C1->getType())->getElementType()->isInteger())) &&
> + assert((C1->getType()->isIntegral() || (isa<PackedType>(C1->getType()) &&
> + cast<PackedType>(C1->getType())->getElementType()->isIntegral())) &&
Okay.
> "Tried to create an arithmetic operation on a non-arithmetic type!");
> break;
> case Instruction::FDiv:
> @@ -1669,8 +1669,8 @@
> case Instruction::URem:
> case Instruction::SRem:
> assert(C1->getType() == C2->getType() && "Op types should be identical!");
> - assert((C1->getType()->isInteger() || (isa<PackedType>(C1->getType()) &&
> - cast<PackedType>(C1->getType())->getElementType()->isInteger())) &&
> + assert((C1->getType()->isIntegral() || (isa<PackedType>(C1->getType()) &&
> + cast<PackedType>(C1->getType())->getElementType()->isIntegral())) &&
Okay.
> "Tried to create an arithmetic operation on a non-arithmetic type!");
> break;
> case Instruction::FRem:
> @@ -1690,7 +1690,7 @@
> case Instruction::LShr:
> case Instruction::AShr:
> assert(C2->getType() == Type::Int8Ty && "Shift should be by ubyte!");
> - assert(C1->getType()->isInteger() &&
> + assert(C1->getType()->isIntegral() &&
> "Tried to create a shift operation on a non-integer type!");
Okay.
> break;
> default:
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list