[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Andrew Lenharth
alenhar2 at cs.uiuc.edu
Wed Sep 20 08:38:23 PDT 2006
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.514 -> 1.515
---
Log message:
simplify
---
Diffs of the changes: (+8 -12)
InstructionCombining.cpp | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.514 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.515
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.514 Tue Sep 19 23:44:59 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Sep 20 10:37:57 2006
@@ -1603,18 +1603,14 @@
CI = dyn_cast<CastInst>(RHS);
Other = LHS;
}
- if (CI) {
- const Type *UIntPtrTy = TD->getIntPtrType();
- const Type *SIntPtrTy = UIntPtrTy->getSignedVersion();
- if((CI->getType() == UIntPtrTy || CI->getType() == SIntPtrTy)
- && isa<PointerType>(CI->getOperand(0)->getType())) {
- Instruction* I2 = new CastInst(CI->getOperand(0),
- PointerType::get(Type::SByteTy), "ctg", &I);
- WorkList.push_back(I2);
- I2 = new GetElementPtrInst(I2, Other, "ctg", &I);
- WorkList.push_back(I2);
- return new CastInst(I2, CI->getType());
- }
+ if (CI && CI->getType()->isSized() &&
+ (CI->getType()->getPrimitiveSize() ==
+ TD->getIntPtrType()->getPrimitiveSize())
+ && isa<PointerType>(CI->getOperand(0)->getType())) {
+ Value* I2 = InsertCastBefore(CI->getOperand(0),
+ PointerType::get(Type::SByteTy), I);
+ I2 = InsertNewInstBefore(new GetElementPtrInst(I2, Other, "ctg2"), I);
+ return new CastInst(I2, CI->getType());
}
}
More information about the llvm-commits
mailing list