[llvm-commits] [llvm] r43775 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp

Duncan Sands baldrick at free.fr
Tue Nov 6 12:39:12 PST 2007


Author: baldrick
Date: Tue Nov  6 14:39:11 2007
New Revision: 43775

URL: http://llvm.org/viewvc/llvm-project?rev=43775&view=rev
Log:
At the point of calculating the shift amount, the
type of SV has changed from what it originally was.
However we need the store width of the original.

Modified:
    llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=43775&r1=43774&r2=43775&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Nov  6 14:39:11 2007
@@ -1179,6 +1179,8 @@
         // here.
         unsigned SrcWidth = TD.getTypeSizeInBits(SV->getType());
         unsigned DestWidth = TD.getTypeSizeInBits(AllocaType);
+        unsigned SrcStoreWidth = TD.getTypeStoreSizeInBits(SV->getType());
+        unsigned DestStoreWidth = TD.getTypeStoreSizeInBits(AllocaType);
         if (SV->getType()->isFloatingPoint())
           SV = new BitCastInst(SV, IntegerType::get(SrcWidth),
                                SV->getName(), SI);
@@ -1196,8 +1198,7 @@
           // On big-endian machines, the lowest bit is stored at the bit offset
           // from the pointer given by getTypeStoreSizeInBits.  This matters for
           // integers with a bitwidth that is not a multiple of 8.
-          ShAmt = TD.getTypeStoreSizeInBits(AllocaType) -
-            TD.getTypeStoreSizeInBits(SV->getType()) - Offset;
+          ShAmt = DestStoreWidth - SrcStoreWidth - Offset;
         } else {
           ShAmt = Offset;
         }





More information about the llvm-commits mailing list