[llvm-branch-commits] [llvm-gcc-branch] r92479 - /llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/llvm-convert.cpp

Bill Wendling isanbard at gmail.com
Mon Jan 4 09:04:07 PST 2010


Author: void
Date: Mon Jan  4 11:04:06 2010
New Revision: 92479

URL: http://llvm.org/viewvc/llvm-project?rev=92479&view=rev
Log:
$ svn merge -c 92108 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk
--- Merging r92108 into '.':
U    gcc/llvm-convert.cpp


Modified:
    llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/llvm-convert.cpp?rev=92479&r1=92478&r2=92479&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Leela-M1/gcc/llvm-convert.cpp Mon Jan  4 11:04:06 2010
@@ -2999,9 +2999,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