Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.606 -> 1.607 --- Log message: Revise the store V, (cast P) -> store (cast V) -> P transform. We only want to do this if the src and destination types have the same bit width. This patch uses TargetData::getTypeSizeInBits() instead of making a special case for integer types and avoiding the transform if they don't match. --- Diffs of the changes: (+4 -9) InstructionCombining.cpp | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.606 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.607 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.606 Sat Jan 20 16:35:55 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Jan 20 17:35:48 2007 @@ -8192,10 +8192,9 @@ SrcPTy = SrcTy->getElementType(); } - if (((SrcPTy->isInteger() && SrcPTy != Type::Int1Ty) || - isa<PointerType>(SrcPTy)) && - IC.getTargetData().getTypeSize(SrcPTy) == - IC.getTargetData().getTypeSize(DestPTy)) { + if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy)) && + IC.getTargetData().getTypeSizeInBits(SrcPTy) == + IC.getTargetData().getTypeSizeInBits(DestPTy)) { // Okay, we are casting from one integer or pointer type to another of // the same size. Instead of casting the pointer before @@ -8208,13 +8207,9 @@ if (isa<PointerType>(CastDstTy)) { if (CastSrcTy->isInteger()) opcode = Instruction::IntToPtr; - } else if (const IntegerType* DITy = dyn_cast<IntegerType>(CastDstTy)) { + } else if (isa<IntegerType>(CastDstTy)) { if (isa<PointerType>(SIOp0->getType())) opcode = Instruction::PtrToInt; - else if (const IntegerType* SITy = dyn_cast<IntegerType>(CastSrcTy)) - if (SITy->getBitWidth() != DITy->getBitWidth()) - return 0; // Don't do this transform on unequal bit widths. - // else, BitCast is fine } if (Constant *C = dyn_cast<Constant>(SIOp0)) NewCast = ConstantExpr::getCast(opcode, C, CastDstTy); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits