aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2007-11-06 20:39:11 +0000
committerDuncan Sands <baldrick@free.fr>2007-11-06 20:39:11 +0000
commit91508a490bc31819d97346083ec02b94eb8d7b27 (patch)
tree84f5b8a9127b9f700bb9a8e3fe881797d99c412f
parent730c273d427709a0caabaf2571c66995edae0b96 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43775 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 8312274a43..ed49793b9e 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/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;
}