[llvm-commits] [SignlessTypes] CVS: llvm/lib/Transforms/Utils/Local.cpp LowerAllocations.cpp LowerSwitch.cpp SimplifyCFG.cpp
Reid Spencer
reid at x10sys.com
Thu Oct 19 17:35:19 PDT 2006
Changes in directory llvm/lib/Transforms/Utils:
Local.cpp updated: 1.58.4.1 -> 1.58.4.2
LowerAllocations.cpp updated: 1.61.2.1 -> 1.61.2.2
LowerSwitch.cpp updated: 1.24.2.1 -> 1.24.2.2
SimplifyCFG.cpp updated: 1.99 -> 1.99.2.1
---
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: (+7 -7)
Local.cpp | 8 ++++----
LowerAllocations.cpp | 2 +-
LowerSwitch.cpp | 2 +-
SimplifyCFG.cpp | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
Index: llvm/lib/Transforms/Utils/Local.cpp
diff -u llvm/lib/Transforms/Utils/Local.cpp:1.58.4.1 llvm/lib/Transforms/Utils/Local.cpp:1.58.4.2
--- llvm/lib/Transforms/Utils/Local.cpp:1.58.4.1 Wed Oct 18 22:57:56 2006
+++ llvm/lib/Transforms/Utils/Local.cpp Thu Oct 19 19:34:44 2006
@@ -287,10 +287,10 @@
}
} else if (ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand())) {
if (const ArrayType *ATy = dyn_cast<ArrayType>(*I)) {
- if ((uint64_t)CI->getRawValue() >= ATy->getNumElements())
+ if (CI->getZExtValue() >= ATy->getNumElements())
return 0;
if (ConstantArray *CA = dyn_cast<ConstantArray>(C))
- C = CA->getOperand((unsigned)CI->getRawValue());
+ C = CA->getOperand(CI->getZExtValue());
else if (isa<ConstantAggregateZero>(C))
C = Constant::getNullValue(ATy->getElementType());
else if (isa<UndefValue>(C))
@@ -298,10 +298,10 @@
else
return 0;
} else if (const PackedType *PTy = dyn_cast<PackedType>(*I)) {
- if ((uint64_t)CI->getRawValue() >= PTy->getNumElements())
+ if (CI->getZExtValue() >= PTy->getNumElements())
return 0;
if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C))
- C = CP->getOperand((unsigned)CI->getRawValue());
+ C = CP->getOperand(CI->getZExtValue());
else if (isa<ConstantAggregateZero>(C))
C = Constant::getNullValue(PTy->getElementType());
else if (isa<UndefValue>(C))
Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp
diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.61.2.1 llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.61.2.2
--- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.61.2.1 Wed Oct 18 22:57:56 2006
+++ llvm/lib/Transforms/Utils/LowerAllocations.cpp Thu Oct 19 19:34:44 2006
@@ -126,7 +126,7 @@
if (MI->isArrayAllocation()) {
if (isa<ConstantInt>(MallocArg) &&
- cast<ConstantInt>(MallocArg)->getRawValue() == 1) {
+ cast<ConstantInt>(MallocArg)->getZExtValue() == 1) {
MallocArg = MI->getOperand(0); // Operand * 1 = Operand
} else if (Constant *CO = dyn_cast<Constant>(MI->getOperand(0))) {
CO = ConstantExpr::getCast(CO, IntPtrTy);
Index: llvm/lib/Transforms/Utils/LowerSwitch.cpp
diff -u llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.24.2.1 llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.24.2.2
--- llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.24.2.1 Wed Oct 18 22:57:56 2006
+++ llvm/lib/Transforms/Utils/LowerSwitch.cpp Thu Oct 19 19:34:44 2006
@@ -130,7 +130,7 @@
Case& Pivot = *(Begin + Mid);
DEBUG(std::cerr << "Pivot ==> "
- << (int64_t)cast<ConstantInt>(Pivot.first)->getRawValue()
+ << cast<ConstantInt>(Pivot.first)->getSExtValue()
<< "\n");
BasicBlock* LBranch = switchConvert(LHS.begin(), LHS.end(), Val,
Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.99 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.99.2.1
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.99 Thu Aug 3 16:40:24 2006
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Thu Oct 19 19:34:44 2006
@@ -1153,7 +1153,7 @@
/// applications that sort ConstantInt's to ensure uniqueness.
struct ConstantIntOrdering {
bool operator()(const ConstantInt *LHS, const ConstantInt *RHS) const {
- return LHS->getRawValue() < RHS->getRawValue();
+ return LHS->getZExtValue() < RHS->getZExtValue();
}
};
}
More information about the llvm-commits
mailing list