[llvm] 005f826 - [SLP] Use for-range loops across ValueLists. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 10:25:14 PDT 2020
Author: Simon Pilgrim
Date: 2020-09-21T18:24:23+01:00
New Revision: 005f826a0546eb11890b7bd36fea6b8b1c5e3fc4
URL: https://github.com/llvm/llvm-project/commit/005f826a0546eb11890b7bd36fea6b8b1c5e3fc4
DIFF: https://github.com/llvm/llvm-project/commit/005f826a0546eb11890b7bd36fea6b8b1c5e3fc4.diff
LOG: [SLP] Use for-range loops across ValueLists. NFCI.
Also rename some existing loops that used a 'j' iterator to consistently use 'V'.
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 475966f203f3..e2588036fbff 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -1756,9 +1756,9 @@ class BoUpSLP {
Last->ReorderIndices.append(ReorderIndices.begin(), ReorderIndices.end());
Last->setOperations(S);
if (Vectorized) {
- for (int i = 0, e = VL.size(); i != e; ++i) {
- assert(!getTreeEntry(VL[i]) && "Scalar already in tree!");
- ScalarToTreeEntry[VL[i]] = Last;
+ for (Value *V : VL) {
+ assert(!getTreeEntry(V) && "Scalar already in tree!");
+ ScalarToTreeEntry[V] = Last;
}
// Update the scheduler bundle to point to this TreeEntry.
unsigned Lane = 0;
@@ -2691,10 +2691,10 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
auto *PH = cast<PHINode>(VL0);
// Check for terminator values (e.g. invoke).
- for (unsigned j = 0; j < VL.size(); ++j)
+ for (Value *V : VL)
for (unsigned i = 0, e = PH->getNumIncomingValues(); i < e; ++i) {
Instruction *Term = dyn_cast<Instruction>(
- cast<PHINode>(VL[j])->getIncomingValueForBlock(
+ cast<PHINode>(V)->getIncomingValueForBlock(
PH->getIncomingBlock(i)));
if (Term && Term->isTerminator()) {
LLVM_DEBUG(dbgs()
@@ -2715,8 +2715,8 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
for (unsigned i = 0, e = PH->getNumIncomingValues(); i < e; ++i) {
ValueList Operands;
// Prepare the operand vector.
- for (Value *j : VL)
- Operands.push_back(cast<PHINode>(j)->getIncomingValueForBlock(
+ for (Value *V : VL)
+ Operands.push_back(cast<PHINode>(V)->getIncomingValueForBlock(
PH->getIncomingBlock(i)));
TE->setOperand(i, Operands);
OperandsVec.push_back(Operands);
@@ -2975,8 +2975,8 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
for (unsigned i = 0, e = VL0->getNumOperands(); i < e; ++i) {
ValueList Operands;
// Prepare the operand vector.
- for (Value *j : VL)
- Operands.push_back(cast<Instruction>(j)->getOperand(i));
+ for (Value *V : VL)
+ Operands.push_back(cast<Instruction>(V)->getOperand(i));
buildTree_rec(Operands, Depth + 1, {TE, i});
}
More information about the llvm-commits
mailing list