diff options
author | Duncan Sands <baldrick@free.fr> | 2007-11-06 20:39:11 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2007-11-06 20:39:11 +0000 |
commit | f042e862fd923a3a2784d1f87f21d1a194272808 (patch) | |
tree | 68c3c1a9e233c5921c53e9ddc4f76c46e1309bd8 /llvm/lib/Transforms | |
parent | 77068e17d456d60e220e089266e59187e2589d13 (diff) | |
download | bcm5719-llvm-f042e862fd923a3a2784d1f87f21d1a194272808.tar.gz bcm5719-llvm-f042e862fd923a3a2784d1f87f21d1a194272808.zip |
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.
llvm-svn: 43775
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 8312274a438..ed49793b9e9 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -1179,6 +1179,8 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { // 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 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { // 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; } |