[llvm-branch-commits] [llvm-gcc-branch] r92442 - /llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp
Dale Johannesen
dalej at apple.com
Sat Jan 2 18:49:22 PST 2010
Author: johannes
Date: Sat Jan 2 20:49:22 2010
New Revision: 92442
URL: http://llvm.org/viewvc/llvm-project?rev=92442&view=rev
Log:
--- Merging r92108 into '.':
U gcc/llvm-convert.cpp
Modified:
llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp?rev=92442&r1=92441&r2=92442&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp Sat Jan 2 20:49:22 2010
@@ -2939,9 +2939,13 @@
if (ValTy->isSingleValueType()) {
// Non-bitfield, scalar value. Just emit a store.
Value *RHS = Emit(rhs, 0);
- // Convert RHS to the right type if we can, otherwise convert the pointer.
+ // Convert RHS to the right type if we can. If LHS is bigger than RHS
+ // we must convert; all the bits of LHS must be stored into. Otherwise
+ // convert the pointer.
const PointerType *PT = cast<PointerType>(LV.Ptr->getType());
- if (PT->getElementType()->canLosslesslyBitCastTo(RHS->getType()))
+ if (PT->getElementType()->canLosslesslyBitCastTo(RHS->getType()) ||
+ (PT->getElementType()->getPrimitiveSizeInBits() >
+ RHS->getType()->getPrimitiveSizeInBits()))
RHS = CastToAnyType(RHS, RHSSigned, PT->getElementType(), LHSSigned);
else
LV.Ptr = BitCastToType(LV.Ptr, RHS->getType()->getPointerTo());
More information about the llvm-branch-commits
mailing list