diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2006-09-20 15:37:57 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2006-09-20 15:37:57 +0000 |
commit | 44cb67af5c8c9359dc06efd9c64aa68c8f388e79 (patch) | |
tree | 69e4e6a54aba7bf431ff1feb557f364b05b4de3a /llvm/lib/Transforms | |
parent | f007f21c8a286f246620b5a5265f50df12463204 (diff) | |
download | bcm5719-llvm-44cb67af5c8c9359dc06efd9c64aa68c8f388e79.tar.gz bcm5719-llvm-44cb67af5c8c9359dc06efd9c64aa68c8f388e79.zip |
simplify
llvm-svn: 30535
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 8f6d5348e67..79c204f93eb 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1603,18 +1603,14 @@ FoundSExt: 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()); } } |