diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index b549e803177..a2d210a36f2 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -1202,7 +1202,7 @@ static Value *GetStoreValueForLoad(Value *SrcVal, unsigned Offset,
   if (TD.isLittleEndian()) {
     ShiftAmt = Offset*8;
   } else {
-    ShiftAmt = StoreSize-LoadSize-Offset;
+    ShiftAmt = (StoreSize-LoadSize-Offset)*8;
   }
   
   if (ShiftAmt)