[llvm-commits] [llvm] r42985 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Devang Patel
dpatel at apple.com
Mon Oct 15 08:31:35 PDT 2007
Author: dpatel
Date: Mon Oct 15 10:31:35 2007
New Revision: 42985
URL: http://llvm.org/viewvc/llvm-project?rev=42985&view=rev
Log:
Achieve same result but use fewer lines of code.
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=42985&r1=42984&r2=42985&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Oct 15 10:31:35 2007
@@ -7674,14 +7674,13 @@
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);
More information about the llvm-commits
mailing list