[llvm-commits] [SignlessTypes] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp Instruction.cpp Instructions.cpp
Reid Spencer
reid at x10sys.com
Thu Oct 19 17:35:16 PDT 2006
Changes in directory llvm/lib/VMCore:
ConstantFolding.cpp updated: 1.93.2.2 -> 1.93.2.3
Constants.cpp updated: 1.163.2.2 -> 1.163.2.3
Instruction.cpp updated: 1.53.2.1 -> 1.53.2.2
Instructions.cpp updated: 1.42.2.2 -> 1.42.2.3
---
Log message:
Make some simplifications for ConstantInt:
1. Get rid of getRawValue, replace with getZExtValue
2. Single constructor (uint64_t) and get method (int64_t)
3. Canonicalize the constant to a zero extended unsigned 64-bit integer when
it is created.
4. Adjust getZExtValue() to be a do-nothing (just returns the already
canonicalized value).
5. Compensate for above changes everywhere else.
---
Diffs of the changes: (+72 -138)
ConstantFolding.cpp | 123 +++++++++++++++++++---------------------------------
Constants.cpp | 79 +++++++++------------------------
Instruction.cpp | 6 --
Instructions.cpp | 2
4 files changed, 72 insertions(+), 138 deletions(-)
Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.2 llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.3
--- llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.2 Thu Oct 19 14:53:31 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp Thu Oct 19 19:34:44 2006
@@ -40,8 +40,7 @@
virtual Constant *add(const Constant *V1, const Constant *V2) const = 0;
virtual Constant *sub(const Constant *V1, const Constant *V2) const = 0;
virtual Constant *mul(const Constant *V1, const Constant *V2) const = 0;
- virtual Constant *udiv(const Constant *V1, const Constant *V2) const = 0;
- virtual Constant *sdiv(const Constant *V1, const Constant *V2) const = 0;
+ virtual Constant *div(const Constant *V1, const Constant *V2) const = 0;
virtual Constant *rem(const Constant *V1, const Constant *V2) const = 0;
virtual Constant *op_and(const Constant *V1, const Constant *V2) const = 0;
virtual Constant *op_or (const Constant *V1, const Constant *V2) const = 0;
@@ -107,11 +106,8 @@
virtual Constant *mul(const Constant *V1, const Constant *V2) const {
return SubClassName::Mul((const ArgType *)V1, (const ArgType *)V2);
}
- virtual Constant *udiv(const Constant *V1, const Constant *V2) const {
- return SubClassName::UDiv((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *sdiv(const Constant *V1, const Constant *V2) const {
- return SubClassName::SDiv((const ArgType *)V1, (const ArgType *)V2);
+ virtual Constant *div(const Constant *V1, const Constant *V2) const {
+ return SubClassName::Div((const ArgType *)V1, (const ArgType *)V2);
}
virtual Constant *rem(const Constant *V1, const Constant *V2) const {
return SubClassName::Rem((const ArgType *)V1, (const ArgType *)V2);
@@ -182,17 +178,16 @@
// Default "noop" implementations
//===--------------------------------------------------------------------===//
- static Constant *Add (const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *Sub (const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *Mul (const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *SDiv(const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *UDiv(const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *Rem (const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *And (const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *Xor (const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *Shl (const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *Shr (const ArgType *V1, const ArgType *V2) { return 0; }
+ static Constant *Add(const ArgType *V1, const ArgType *V2) { return 0; }
+ static Constant *Sub(const ArgType *V1, const ArgType *V2) { return 0; }
+ static Constant *Mul(const ArgType *V1, const ArgType *V2) { return 0; }
+ static Constant *Div(const ArgType *V1, const ArgType *V2) { return 0; }
+ static Constant *Rem(const ArgType *V1, const ArgType *V2) { return 0; }
+ static Constant *And(const ArgType *V1, const ArgType *V2) { return 0; }
+ static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; }
+ static Constant *Xor(const ArgType *V1, const ArgType *V2) { return 0; }
+ static Constant *Shl(const ArgType *V1, const ArgType *V2) { return 0; }
+ static Constant *Shr(const ArgType *V1, const ArgType *V2) { return 0; }
static Constant *LessThan(const ArgType *V1, const ArgType *V2) {
return 0;
}
@@ -378,11 +373,8 @@
static Constant *Mul(const ConstantPacked *V1, const ConstantPacked *V2) {
return EvalVectorOp(V1, V2, ConstantExpr::getMul);
}
- static Constant *UDiv(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getUDiv);
- }
- static Constant *SDiv(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getSDiv);
+ static Constant *Div(const ConstantPacked *V1, const ConstantPacked *V2) {
+ return EvalVectorOp(V1, V2, ConstantExpr::getDiv);
}
static Constant *Rem(const ConstantPacked *V1, const ConstantPacked *V2) {
return EvalVectorOp(V1, V2, ConstantExpr::getRem);
@@ -448,30 +440,30 @@
: public TemplateRules<ConstantInt, DirectIntRules<BuiltinType, Ty> > {
static Constant *Add(const ConstantInt *V1, const ConstantInt *V2) {
- BuiltinType R = (BuiltinType)V1->getRawValue() +
- (BuiltinType)V2->getRawValue();
+ BuiltinType R = (BuiltinType)V1->getZExtValue() +
+ (BuiltinType)V2->getZExtValue();
return ConstantInt::get(*Ty, R);
}
static Constant *Sub(const ConstantInt *V1, const ConstantInt *V2) {
- BuiltinType R = (BuiltinType)V1->getRawValue() -
- (BuiltinType)V2->getRawValue();
+ BuiltinType R = (BuiltinType)V1->getZExtValue() -
+ (BuiltinType)V2->getZExtValue();
return ConstantInt::get(*Ty, R);
}
static Constant *Mul(const ConstantInt *V1, const ConstantInt *V2) {
- BuiltinType R = (BuiltinType)V1->getRawValue() *
- (BuiltinType)V2->getRawValue();
+ BuiltinType R = (BuiltinType)V1->getZExtValue() *
+ (BuiltinType)V2->getZExtValue();
return ConstantInt::get(*Ty, R);
}
static Constant *LessThan(const ConstantInt *V1, const ConstantInt *V2) {
- bool R = (BuiltinType)V1->getRawValue() < (BuiltinType)V2->getRawValue();
+ bool R = (BuiltinType)V1->getZExtValue() < (BuiltinType)V2->getZExtValue();
return ConstantBool::get(R);
}
static Constant *EqualTo(const ConstantInt *V1, const ConstantInt *V2) {
- bool R = (BuiltinType)V1->getRawValue() == (BuiltinType)V2->getRawValue();
+ bool R = (BuiltinType)V1->getZExtValue() == (BuiltinType)V2->getZExtValue();
return ConstantBool::get(R);
}
@@ -485,7 +477,7 @@
// Casting operators. ick
#define DEF_CAST(TYPE, CLASS, CTYPE) \
static Constant *CastTo##TYPE (const ConstantInt *V) { \
- return CLASS::get(Type::TYPE##Ty, (CTYPE)(BuiltinType)V->getRawValue()); \
+ return CLASS::get(Type::TYPE##Ty, (CTYPE)(BuiltinType)V->getZExtValue()); \
}
DEF_CAST(Bool , ConstantBool, bool)
@@ -501,25 +493,13 @@
DEF_CAST(Double, ConstantFP , double)
#undef DEF_CAST
- static Constant *UDiv(const ConstantInt *V1, const ConstantInt *V2) {
- if (V2->isNullValue())
- return 0;
- if (V2->isAllOnesValue() && // MIN_INT / -1
- (BuiltinType)V1->getRawValue() == -(BuiltinType)V1->getRawValue())
- return 0;
- BuiltinType R =
- (BuiltinType)V1->getRawValue() / (BuiltinType)V2->getRawValue();
- return ConstantInt::get(*Ty, R);
- }
-
- static Constant *SDiv(const ConstantInt *V1, const ConstantInt *V2) {
- if (V2->isNullValue())
- return 0;
+ static Constant *Div(const ConstantInt *V1, const ConstantInt *V2) {
+ if (V2->isNullValue()) return 0;
if (V2->isAllOnesValue() && // MIN_INT / -1
- (BuiltinType)V1->getRawValue() == -(BuiltinType)V1->getRawValue())
+ (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1->getZExtValue())
return 0;
BuiltinType R =
- (BuiltinType)V1->getRawValue() / (BuiltinType)V2->getRawValue();
+ (BuiltinType)V1->getZExtValue() / (BuiltinType)V2->getZExtValue();
return ConstantInt::get(*Ty, R);
}
@@ -527,38 +507,38 @@
const ConstantInt *V2) {
if (V2->isNullValue()) return 0; // X / 0
if (V2->isAllOnesValue() && // MIN_INT / -1
- (BuiltinType)V1->getRawValue() == -(BuiltinType)V1->getRawValue())
+ (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1->getZExtValue())
return 0;
BuiltinType R =
- (BuiltinType)V1->getRawValue() % (BuiltinType)V2->getRawValue();
+ (BuiltinType)V1->getZExtValue() % (BuiltinType)V2->getZExtValue();
return ConstantInt::get(*Ty, R);
}
static Constant *And(const ConstantInt *V1, const ConstantInt *V2) {
BuiltinType R =
- (BuiltinType)V1->getRawValue() & (BuiltinType)V2->getRawValue();
+ (BuiltinType)V1->getZExtValue() & (BuiltinType)V2->getZExtValue();
return ConstantInt::get(*Ty, R);
}
static Constant *Or(const ConstantInt *V1, const ConstantInt *V2) {
BuiltinType R =
- (BuiltinType)V1->getRawValue() | (BuiltinType)V2->getRawValue();
+ (BuiltinType)V1->getZExtValue() | (BuiltinType)V2->getZExtValue();
return ConstantInt::get(*Ty, R);
}
static Constant *Xor(const ConstantInt *V1, const ConstantInt *V2) {
BuiltinType R =
- (BuiltinType)V1->getRawValue() ^ (BuiltinType)V2->getRawValue();
+ (BuiltinType)V1->getZExtValue() ^ (BuiltinType)V2->getZExtValue();
return ConstantInt::get(*Ty, R);
}
static Constant *Shl(const ConstantInt *V1, const ConstantInt *V2) {
BuiltinType R =
- (BuiltinType)V1->getRawValue() << (BuiltinType)V2->getRawValue();
+ (BuiltinType)V1->getZExtValue() << (BuiltinType)V2->getZExtValue();
return ConstantInt::get(*Ty, R);
}
static Constant *Shr(const ConstantInt *V1, const ConstantInt *V2) {
BuiltinType R =
- (BuiltinType)V1->getRawValue() >> (BuiltinType)V2->getRawValue();
+ (BuiltinType)V1->getZExtValue() >> (BuiltinType)V2->getZExtValue();
return ConstantInt::get(*Ty, R);
}
};
@@ -635,14 +615,7 @@
(BuiltinType)V2->getValue());
return ConstantFP::get(*Ty, Result);
}
- static Constant *UDiv(const ConstantFP *V1, const ConstantFP *V2) {
- BuiltinType inf = std::numeric_limits<BuiltinType>::infinity();
- if (V2->isExactlyValue(0.0)) return ConstantFP::get(*Ty, inf);
- if (V2->isExactlyValue(-0.0)) return ConstantFP::get(*Ty, -inf);
- BuiltinType R = (BuiltinType)V1->getValue() / (BuiltinType)V2->getValue();
- return ConstantFP::get(*Ty, R);
- }
- static Constant *SDiv(const ConstantFP *V1, const ConstantFP *V2) {
+ static Constant *Div(const ConstantFP *V1, const ConstantFP *V2) {
BuiltinType inf = std::numeric_limits<BuiltinType>::infinity();
if (V2->isExactlyValue(0.0)) return ConstantFP::get(*Ty, inf);
if (V2->isExactlyValue(-0.0)) return ConstantFP::get(*Ty, -inf);
@@ -741,7 +714,7 @@
if (DstEltTy->getTypeID() == Type::DoubleTyID) {
for (unsigned i = 0; i != SrcNumElts; ++i) {
double V =
- BitsToDouble(cast<ConstantInt>(CP->getOperand(i))->getRawValue());
+ BitsToDouble(cast<ConstantInt>(CP->getOperand(i))->getZExtValue());
Result.push_back(ConstantFP::get(Type::DoubleTy, V));
}
return ConstantPacked::get(Result);
@@ -749,7 +722,7 @@
assert(DstEltTy == Type::FloatTy && "Unknown fp type!");
for (unsigned i = 0; i != SrcNumElts; ++i) {
float V =
- BitsToFloat(cast<ConstantInt>(CP->getOperand(i))->getRawValue());
+ BitsToFloat(cast<ConstantInt>(CP->getOperand(i))->getZExtValue());
Result.push_back(ConstantFP::get(Type::FloatTy, V));
}
return ConstantPacked::get(Result);
@@ -1251,8 +1224,7 @@
case Instruction::Add: C = ConstRules::get(V1, V2).add(V1, V2); break;
case Instruction::Sub: C = ConstRules::get(V1, V2).sub(V1, V2); break;
case Instruction::Mul: C = ConstRules::get(V1, V2).mul(V1, V2); break;
- case Instruction::UDiv: C = ConstRules::get(V1, V2).udiv(V1, V2); break;
- case Instruction::SDiv: C = ConstRules::get(V1, V2).sdiv(V1, V2); break;
+ case Instruction::Div: C = ConstRules::get(V1, V2).div(V1, V2); break;
case Instruction::Rem: C = ConstRules::get(V1, V2).rem(V1, V2); break;
case Instruction::And: C = ConstRules::get(V1, V2).op_and(V1, V2); break;
case Instruction::Or: C = ConstRules::get(V1, V2).op_or (V1, V2); break;
@@ -1335,8 +1307,7 @@
case Instruction::Mul:
case Instruction::And:
return Constant::getNullValue(V1->getType());
- case Instruction::UDiv:
- case Instruction::SDiv:
+ case Instruction::Div:
case Instruction::Rem:
if (!isa<UndefValue>(V2)) // undef/X -> 0
return Constant::getNullValue(V1->getType());
@@ -1384,18 +1355,17 @@
case Instruction::Mul:
if (V2->isNullValue()) return const_cast<Constant*>(V2); // X * 0 == 0
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V2))
- if (CI->getRawValue() == 1)
+ if (CI->getZExtValue() == 1)
return const_cast<Constant*>(V1); // X * 1 == X
break;
- case Instruction::UDiv:
- case Instruction::SDiv:
+ case Instruction::Div:
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V2))
- if (CI->getRawValue() == 1)
+ if (CI->getZExtValue() == 1)
return const_cast<Constant*>(V1); // X / 1 == X
break;
case Instruction::Rem:
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V2))
- if (CI->getRawValue() == 1)
+ if (CI->getZExtValue() == 1)
return Constant::getNullValue(CI->getType()); // X % 1 == 0
break;
case Instruction::And:
@@ -1409,7 +1379,7 @@
// Functions are at least 4-byte aligned. If and'ing the address of a
// function with a constant < 4, fold it to zero.
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V2))
- if (CI->getRawValue() < 4 && isa<Function>(CPR))
+ if (CI->getZExtValue() < 4 && isa<Function>(CPR))
return Constant::getNullValue(CI->getType());
}
break;
@@ -1449,8 +1419,7 @@
case Instruction::Shl:
case Instruction::Shr:
case Instruction::Sub:
- case Instruction::SDiv:
- case Instruction::UDiv:
+ case Instruction::Div:
case Instruction::Rem:
default: // These instructions cannot be flopped around.
break;
Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.163.2.2 llvm/lib/VMCore/Constants.cpp:1.163.2.3
--- llvm/lib/VMCore/Constants.cpp:1.163.2.2 Thu Oct 19 14:53:31 2006
+++ llvm/lib/VMCore/Constants.cpp Thu Oct 19 19:34:44 2006
@@ -66,35 +66,35 @@
return NullBool;
}
case Type::SByteTyID: {
- static Constant *NullSByte = ConstantInt::get(Type::SByteTy, int8_t(0));
+ static Constant *NullSByte = ConstantInt::get(Type::SByteTy, 0);
return NullSByte;
}
case Type::UByteTyID: {
- static Constant *NullUByte = ConstantInt::get(Type::UByteTy, uint8_t(0));
+ static Constant *NullUByte = ConstantInt::get(Type::UByteTy, 0);
return NullUByte;
}
case Type::ShortTyID: {
- static Constant *NullShort = ConstantInt::get(Type::ShortTy, int16_t(0));
+ static Constant *NullShort = ConstantInt::get(Type::ShortTy, 0);
return NullShort;
}
case Type::UShortTyID: {
- static Constant *NullUShort = ConstantInt::get(Type::UShortTy, uint16_t(0));
+ static Constant *NullUShort = ConstantInt::get(Type::UShortTy, 0);
return NullUShort;
}
case Type::IntTyID: {
- static Constant *NullInt = ConstantInt::get(Type::IntTy, int32_t(0));
+ static Constant *NullInt = ConstantInt::get(Type::IntTy, 0);
return NullInt;
}
case Type::UIntTyID: {
- static Constant *NullUInt = ConstantInt::get(Type::UIntTy, uint32_t(0));
+ static Constant *NullUInt = ConstantInt::get(Type::UIntTy, 0);
return NullUInt;
}
case Type::LongTyID: {
- static Constant *NullLong = ConstantInt::get(Type::LongTy, int64_t(0));
+ static Constant *NullLong = ConstantInt::get(Type::LongTy, 0);
return NullLong;
}
case Type::ULongTyID: {
- static Constant *NullULong = ConstantInt::get(Type::ULongTy, uint64_t(0));
+ static Constant *NullULong = ConstantInt::get(Type::ULongTy, 0);
return NullULong;
}
@@ -176,7 +176,7 @@
case Type::SByteTyID:
case Type::ShortTyID:
case Type::IntTyID:
- case Type::LongTyID: return ConstantInt::get(Ty, int32_t(-1));
+ case Type::LongTyID: return ConstantInt::get(Ty, -1);
case Type::UByteTyID:
case Type::UShortTyID:
@@ -201,12 +201,7 @@
ConstantIntegral::ConstantIntegral(const Type *Ty, ValueTy VT, uint64_t V)
: Constant(Ty, VT, 0, 0) {
- Val.Unsigned = V;
-}
-
-ConstantIntegral::ConstantIntegral(const Type *Ty, ValueTy VT, int64_t V)
- : Constant(Ty, VT, 0, 0) {
- Val.Signed = V;
+ Val.Unsigned = V;
}
ConstantBool::ConstantBool(bool V)
@@ -217,10 +212,6 @@
: ConstantIntegral(Ty, ConstantIntVal, V) {
}
-ConstantInt::ConstantInt(const Type *Ty, int64_t V)
- : ConstantIntegral(Ty, ConstantIntVal, V) {
-}
-
ConstantFP::ConstantFP(const Type *Ty, double V)
: Constant(Ty, ConstantFPVal, 0, 0) {
assert(isValueValidForType(Ty, V) && "Value too large for type!");
@@ -429,11 +420,8 @@
Constant *ConstantExpr::getMul(Constant *C1, Constant *C2) {
return get(Instruction::Mul, C1, C2);
}
-Constant *ConstantExpr::getUDiv(Constant *C1, Constant *C2) {
- return get(Instruction::UDiv, C1, C2);
-}
-Constant *ConstantExpr::getSDiv(Constant *C1, Constant *C2) {
- return get(Instruction::SDiv, C1, C2);
+Constant *ConstantExpr::getDiv(Constant *C1, Constant *C2) {
+ return get(Instruction::Div, C1, C2);
}
Constant *ConstantExpr::getRem(Constant *C1, Constant *C2) {
return get(Instruction::Rem, C1, C2);
@@ -898,36 +886,15 @@
//
static ManagedStatic<ValueMap<uint64_t, Type, ConstantInt> > IntConstants;
+// Get a ConstantInt from an int64_t. Note here that we canoncialize the value
+// to a uint64_t value that has been zero extended down to the size of the
+// integer type of the ConstantInt. This allows the getZExtValue method to
+// just return the stored value while getSExtValue has to convert back to sign
+// extended. getZExtValue is more common in LLVM than getSExtValue().
ConstantInt *ConstantInt::get(const Type *Ty, int64_t V) {
- return IntConstants->getOrCreate(Ty, uint64_t(V));
-}
-
-ConstantInt *ConstantInt::get(const Type *Ty, int32_t V) {
- return IntConstants->getOrCreate(Ty, uint64_t(V));
-}
-
-ConstantInt *ConstantInt::get(const Type *Ty, int16_t V) {
- return IntConstants->getOrCreate(Ty, uint64_t(V));
-}
-
-ConstantInt *ConstantInt::get(const Type *Ty, int8_t V) {
- return IntConstants->getOrCreate(Ty, uint64_t(V));
-}
-
-ConstantInt *ConstantInt::get(const Type *Ty, uint64_t V) {
- return IntConstants->getOrCreate(Ty, uint64_t(V));
-}
-
-ConstantInt *ConstantInt::get(const Type *Ty, uint32_t V) {
- return IntConstants->getOrCreate(Ty, uint64_t(V));
-}
-
-ConstantInt *ConstantInt::get(const Type *Ty, uint16_t V) {
- return IntConstants->getOrCreate(Ty, uint64_t(V));
-}
-
-ConstantInt *ConstantInt::get(const Type *Ty, uint8_t V) {
- return IntConstants->getOrCreate(Ty, uint64_t(V));
+ unsigned Size = Ty->getPrimitiveSizeInBits();
+ uint64_t ZeroExtendedCanonicalization = V & (~uint64_t(0UL) >> (64-Size));
+ return IntConstants->getOrCreate(Ty, ZeroExtendedCanonicalization );
}
//---- ConstantFP::get() implementation...
@@ -1106,7 +1073,7 @@
assert(isString() && "Not a string!");
std::string Result;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
- Result += (char)cast<ConstantInt>(getOperand(i))->getRawValue();
+ Result += (char)cast<ConstantInt>(getOperand(i))->getZExtValue();
return Result;
}
@@ -1470,7 +1437,7 @@
#ifndef NDEBUG
switch (Opcode) {
case Instruction::Add: case Instruction::Sub:
- case Instruction::Mul: case Instruction::UDiv: case Instruction::SDiv:
+ case Instruction::Mul: case Instruction::Div:
case Instruction::Rem:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isInteger() || C1->getType()->isFloatingPoint() ||
@@ -1917,7 +1884,7 @@
if (CE->getNumOperands() == 3 &&
cast<Constant>(CE->getOperand(1))->isNullValue() &&
isa<ConstantInt>(CE->getOperand(2))) {
- Offset += cast<ConstantInt>(CE->getOperand(2))->getRawValue();
+ Offset += cast<ConstantInt>(CE->getOperand(2))->getZExtValue();
return CE->getOperand(0)->getStringValue(Chop, Offset);
}
}
Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.53.2.1 llvm/lib/VMCore/Instruction.cpp:1.53.2.2
--- llvm/lib/VMCore/Instruction.cpp:1.53.2.1 Thu Oct 19 14:53:31 2006
+++ llvm/lib/VMCore/Instruction.cpp Thu Oct 19 19:34:44 2006
@@ -94,8 +94,7 @@
case Add: return "add";
case Sub: return "sub";
case Mul: return "mul";
- case UDiv: return "udiv";
- case SDiv: return "sdiv";
+ case Div: return "div";
case Rem: return "rem";
// Logical operators...
@@ -222,8 +221,7 @@
///
bool Instruction::isTrapping(unsigned op) {
switch(op) {
- case SDiv:
- case UDiv:
+ case Div:
case Rem:
case Load:
case Store:
Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.42.2.2 llvm/lib/VMCore/Instructions.cpp:1.42.2.3
--- llvm/lib/VMCore/Instructions.cpp:1.42.2.2 Thu Oct 19 14:53:31 2006
+++ llvm/lib/VMCore/Instructions.cpp Thu Oct 19 19:34:44 2006
@@ -1022,7 +1022,7 @@
#ifndef NDEBUG
switch (iType) {
case Add: case Sub:
- case Mul: case UDiv: case SDiv:
+ case Mul: case Div:
case Rem:
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
More information about the llvm-commits
mailing list