@@ -628,18 +628,15 @@ std::vector<Chain> Vectorizer::splitChainByContiguity(Chain &C) {
628628
629629 unsigned ElemBytes = DL.getTypeStoreSize (getChainElemTy (C));
630630 APInt PrevReadEnd = C[0 ].OffsetFromLeader +
631- DL.getTypeSizeInBits (getLoadStoreType (&*C[0 ].Inst )) / 8 ;
631+ DL.getTypeStoreSize (getLoadStoreType (&*C[0 ].Inst ));
632632 for (auto It = std::next (C.begin ()), End = C.end (); It != End; ++It) {
633633 // `prev` accesses offsets [PrevDistFromBase, PrevReadEnd).
634634 auto &CurChain = Ret.back ();
635- unsigned SzBits = DL.getTypeSizeInBits (getLoadStoreType (&*It->Inst ));
636- assert (SzBits % 8 == 0 && " Non-byte sizes should have been filtered out by "
637- " collectEquivalenceClass" );
635+ unsigned SzBytes = DL.getTypeStoreSize (getLoadStoreType (&*It->Inst ));
638636
639637 // Add this instruction to the end of the current chain, or start a new one.
640- uint64_t SzBytes = SzBits / 8 ;
641638 assert (SzBytes % ElemBytes == 0 );
642- APInt ReadEnd = It->OffsetFromLeader + SzBits / 8 ;
639+ APInt ReadEnd = It->OffsetFromLeader + SzBytes ;
643640 // Allow redundancy: partial or full overlap counts as contiguous.
644641 bool AreContiguous = false ;
645642 if (It->OffsetFromLeader .sle (PrevReadEnd)) {
@@ -886,12 +883,12 @@ bool Vectorizer::vectorizeChain(Chain &C) {
886883 Type *VecElemTy = getChainElemTy (C);
887884 bool IsLoadChain = isa<LoadInst>(C[0 ].Inst );
888885 unsigned AS = getLoadStoreAddressSpace (C[0 ].Inst );
889- int BytesAdded = DL.getTypeSizeInBits (getLoadStoreType (&*C[0 ].Inst )) / 8 ;
886+ unsigned BytesAdded = DL.getTypeStoreSize (getLoadStoreType (&*C[0 ].Inst ));
890887 APInt PrevReadEnd = C[0 ].OffsetFromLeader + BytesAdded;
891- int ChainBytes = BytesAdded;
888+ unsigned ChainBytes = BytesAdded;
892889 for (auto It = std::next (C.begin ()), End = C.end (); It != End; ++It) {
893- unsigned SzBits = DL.getTypeSizeInBits (getLoadStoreType (&*It->Inst ));
894- APInt ReadEnd = It->OffsetFromLeader + SzBits / 8 ;
890+ unsigned SzBytes = DL.getTypeStoreSize (getLoadStoreType (&*It->Inst ));
891+ APInt ReadEnd = It->OffsetFromLeader + SzBytes ;
895892 // Update ChainBytes considering possible overlap.
896893 BytesAdded =
897894 PrevReadEnd.sle (ReadEnd) ? (ReadEnd - PrevReadEnd).getSExtValue () : 0 ;
0 commit comments