[SLPVectorizer][NFC] Make a loop more readable.

llvm-svn: 324482
This commit is contained in:
Clement Courbet 2018-02-07 14:26:43 +00:00
parent ccb970ee03
commit 9c22d8018c
1 changed files with 5 additions and 7 deletions

View File

@ -4531,23 +4531,21 @@ static bool hasValueBeenRAUWed(ArrayRef<Value *> VL,
bool SLPVectorizerPass::vectorizeStoreChain(ArrayRef<Value *> Chain, BoUpSLP &R, bool SLPVectorizerPass::vectorizeStoreChain(ArrayRef<Value *> Chain, BoUpSLP &R,
unsigned VecRegSize) { unsigned VecRegSize) {
unsigned ChainLen = Chain.size(); const unsigned ChainLen = Chain.size();
DEBUG(dbgs() << "SLP: Analyzing a store chain of length " << ChainLen DEBUG(dbgs() << "SLP: Analyzing a store chain of length " << ChainLen
<< "\n"); << "\n");
unsigned Sz = R.getVectorElementSize(Chain[0]); const unsigned Sz = R.getVectorElementSize(Chain[0]);
unsigned VF = VecRegSize / Sz; const unsigned VF = VecRegSize / Sz;
if (!isPowerOf2_32(Sz) || VF < 2) if (!isPowerOf2_32(Sz) || VF < 2)
return false; return false;
// Keep track of values that were deleted by vectorizing in the loop below. // Keep track of values that were deleted by vectorizing in the loop below.
SmallVector<WeakTrackingVH, 8> TrackValues(Chain.begin(), Chain.end()); const SmallVector<WeakTrackingVH, 8> TrackValues(Chain.begin(), Chain.end());
bool Changed = false; bool Changed = false;
// Look for profitable vectorizable trees at all offsets, starting at zero. // Look for profitable vectorizable trees at all offsets, starting at zero.
for (unsigned i = 0, e = ChainLen; i < e; ++i) { for (unsigned i = 0, e = ChainLen; i + VF <= e; ++i) {
if (i + VF > e)
break;
// Check that a previous iteration of this loop did not delete the Value. // Check that a previous iteration of this loop did not delete the Value.
if (hasValueBeenRAUWed(Chain, TrackValues, i, VF)) if (hasValueBeenRAUWed(Chain, TrackValues, i, VF))