Skip to content

Commit be7f182

Browse files
authored
[LV] Use llvm::all_of in LoopVectorizationCostModel::getMaximizedVFForTarget. NFC (llvm#99585)
1 parent 8bc02bf commit be7f182

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -4594,15 +4594,12 @@ ElementCount LoopVectorizationCostModel::getMaximizedVFForTarget(
45944594

45954595
// Select the largest VF which doesn't require more registers than existing
45964596
// ones.
4597-
for (int i = RUs.size() - 1; i >= 0; --i) {
4598-
bool Selected = true;
4599-
for (auto &pair : RUs[i].MaxLocalUsers) {
4600-
unsigned TargetNumRegisters = TTI.getNumberOfRegisters(pair.first);
4601-
if (pair.second > TargetNumRegisters)
4602-
Selected = false;
4603-
}
4604-
if (Selected) {
4605-
MaxVF = VFs[i];
4597+
for (int I = RUs.size() - 1; I >= 0; --I) {
4598+
const auto &MLU = RUs[I].MaxLocalUsers;
4599+
if (all_of(MLU, [&](decltype(MLU.front()) &LU) {
4600+
return LU.second <= TTI.getNumberOfRegisters(LU.first);
4601+
})) {
4602+
MaxVF = VFs[I];
46064603
break;
46074604
}
46084605
}

0 commit comments

Comments
 (0)