Skip to content

Commit ea1a1eb

Browse files
committed
[NFC] Use std::swap in LoopInterchange
1 parent 1ff9361 commit ea1a1eb

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/lib/Transforms/Scalar/LoopInterchange.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,8 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level,
186186
// matrix by exchanging the two columns.
187187
static void interChangeDependencies(CharMatrix &DepMatrix, unsigned FromIndx,
188188
unsigned ToIndx) {
189-
unsigned numRows = DepMatrix.size();
190-
for (unsigned i = 0; i < numRows; ++i) {
191-
char TmpVal = DepMatrix[i][ToIndx];
192-
DepMatrix[i][ToIndx] = DepMatrix[i][FromIndx];
193-
DepMatrix[i][FromIndx] = TmpVal;
194-
}
189+
for (unsigned I = 0, E = DepMatrix.size(); I < E; ++I)
190+
std::swap(DepMatrix[I][ToIndx], DepMatrix[I][FromIndx]);
195191
}
196192

197193
// Checks if outermost non '=','S'or'I' dependence in the dependence matrix is

0 commit comments

Comments
 (0)