@@ -725,11 +725,11 @@ static Value *CoerceAvailableValueToLoadType(Value *StoredVal, Type *LoadedTy,
725
725
// If this is already the right type, just return it.
726
726
Type *StoredValTy = StoredVal->getType ();
727
727
728
- uint64_t StoreSize = DL.getTypeSizeInBits (StoredValTy);
729
- uint64_t LoadSize = DL.getTypeSizeInBits (LoadedTy);
728
+ uint64_t StoredValSize = DL.getTypeSizeInBits (StoredValTy);
729
+ uint64_t LoadedValSize = DL.getTypeSizeInBits (LoadedTy);
730
730
731
731
// If the store and reload are the same size, we can always reuse it.
732
- if (StoreSize == LoadSize ) {
732
+ if (StoredValSize == LoadedValSize ) {
733
733
// Pointer to Pointer -> use bitcast.
734
734
if (StoredValTy->getScalarType ()->isPointerTy () &&
735
735
LoadedTy->getScalarType ()->isPointerTy ())
@@ -758,7 +758,8 @@ static Value *CoerceAvailableValueToLoadType(Value *StoredVal, Type *LoadedTy,
758
758
// If the loaded value is smaller than the available value, then we can
759
759
// extract out a piece from it. If the available value is too small, then we
760
760
// can't do anything.
761
- assert (StoreSize >= LoadSize && " CanCoerceMustAliasedValueToLoad fail" );
761
+ assert (StoredValSize >= LoadedValSize &&
762
+ " CanCoerceMustAliasedValueToLoad fail" );
762
763
763
764
// Convert source pointers to integers, which can be manipulated.
764
765
if (StoredValTy->getScalarType ()->isPointerTy ()) {
@@ -768,7 +769,7 @@ static Value *CoerceAvailableValueToLoadType(Value *StoredVal, Type *LoadedTy,
768
769
769
770
// Convert vectors and fp to integer, which can be manipulated.
770
771
if (!StoredValTy->isIntegerTy ()) {
771
- StoredValTy = IntegerType::get (StoredValTy->getContext (), StoreSize );
772
+ StoredValTy = IntegerType::get (StoredValTy->getContext (), StoredValSize );
772
773
StoredVal = IRB.CreateBitCast (StoredVal, StoredValTy);
773
774
}
774
775
@@ -781,7 +782,7 @@ static Value *CoerceAvailableValueToLoadType(Value *StoredVal, Type *LoadedTy,
781
782
}
782
783
783
784
// Truncate the integer to the right size now.
784
- Type *NewIntTy = IntegerType::get (StoredValTy->getContext (), LoadSize );
785
+ Type *NewIntTy = IntegerType::get (StoredValTy->getContext (), LoadedValSize );
785
786
StoredVal = IRB.CreateTrunc (StoredVal, NewIntTy, " trunc" );
786
787
787
788
if (LoadedTy == NewIntTy)
@@ -1024,9 +1025,9 @@ static Value *GetLoadValueForLoad(LoadInst *SrcVal, unsigned Offset,
1024
1025
const DataLayout &DL = SrcVal->getModule ()->getDataLayout ();
1025
1026
// If Offset+LoadTy exceeds the size of SrcVal, then we must be wanting to
1026
1027
// widen SrcVal out to a larger load.
1027
- unsigned SrcValSize = DL.getTypeStoreSize (SrcVal->getType ());
1028
+ unsigned SrcValStoreSize = DL.getTypeStoreSize (SrcVal->getType ());
1028
1029
unsigned LoadSize = DL.getTypeStoreSize (LoadTy);
1029
- if (Offset+LoadSize > SrcValSize ) {
1030
+ if (Offset+LoadSize > SrcValStoreSize ) {
1030
1031
assert (SrcVal->isSimple () && " Cannot widen volatile/atomic load!" );
1031
1032
assert (SrcVal->getType ()->isIntegerTy () && " Can't widen non-integer load" );
1032
1033
// If we have a load/load clobber an DepLI can be widened to cover this
@@ -1058,7 +1059,7 @@ static Value *GetLoadValueForLoad(LoadInst *SrcVal, unsigned Offset,
1058
1059
// system, we need to shift down to get the relevant bits.
1059
1060
Value *RV = NewLoad;
1060
1061
if (DL.isBigEndian ())
1061
- RV = Builder.CreateLShr (RV, (NewLoadSize - SrcValSize ) * 8 );
1062
+ RV = Builder.CreateLShr (RV, (NewLoadSize - SrcValStoreSize ) * 8 );
1062
1063
RV = Builder.CreateTrunc (RV, SrcVal->getType ());
1063
1064
SrcVal->replaceAllUsesWith (RV);
1064
1065
0 commit comments