summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-10-15 15:31:35 +0000
committerDevang Patel <dpatel@apple.com>2007-10-15 15:31:35 +0000
commitbff4aea328bc1ad077e12936bdfaeb7fc3af6e1f (patch)
tree5e61dbb51e78e9b6f64b604ad0cd1d387fa7d21f /llvm/lib
parent9130551996eedb6443e43434e0722ac5f7421a60 (diff)
downloadbcm5719-llvm-bff4aea328bc1ad077e12936bdfaeb7fc3af6e1f.tar.gz
bcm5719-llvm-bff4aea328bc1ad077e12936bdfaeb7fc3af6e1f.zip
Achieve same result but use fewer lines of code.
llvm-svn: 42985
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 3edc86b93d2..29223daab7a 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -7674,14 +7674,13 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
unsigned Align = cast<ConstantInt>(CI.getOperand(4))->getZExtValue();
PointerType *NewPtrTy = NULL;
// Destination pointer type is always i8 *
- if (Size == 8)
- NewPtrTy = PointerType::get(Type::Int64Ty);
- else if (Size == 4)
- NewPtrTy = PointerType::get(Type::Int32Ty);
- else if (Size == 2)
- NewPtrTy = PointerType::get(Type::Int16Ty);
- else if (Size == 1)
- NewPtrTy = PointerType::get(Type::Int8Ty);
+ // If Size is 8 then use Int64Ty
+ // If Size is 4 then use Int32Ty
+ // If Size is 2 then use Int16Ty
+ // If Size is 1 then use Int8Ty
+ if (Size && Size <=8 && !(Size&(Size-1)))
+ NewPtrTy = PointerType::get(IntegerType::get(Size<<3));
+
if (NewPtrTy) {
Value *Src = InsertCastBefore(Instruction::BitCast, CI.getOperand(2), NewPtrTy, CI);
Value *Dest = InsertCastBefore(Instruction::BitCast, CI.getOperand(1), NewPtrTy, CI);
OpenPOWER on IntegriCloud