diff options
author | Ta-Wei Tu <tu.da.wei@gmail.com> | 2021-03-02 11:42:48 +0800 |
---|---|---|
committer | Ta-Wei Tu <tu.da.wei@gmail.com> | 2021-03-02 11:42:48 +0800 |
commit | ea1a1ebbc673d810f1abf6cb58a40b5ec916ff07 (patch) | |
tree | ac792de20deb98c081d76ba981baa8a2391a5c76 | |
parent | 1ff93618e58df210def48d26878c20a1b414d900 (diff) | |
download | llvm-ea1a1ebbc673d810f1abf6cb58a40b5ec916ff07.zip llvm-ea1a1ebbc673d810f1abf6cb58a40b5ec916ff07.tar.gz llvm-ea1a1ebbc673d810f1abf6cb58a40b5ec916ff07.tar.bz2 |
[NFC] Use std::swap in LoopInterchange
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopInterchange.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp index b6e071f..0162bf1 100644 --- a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp +++ b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp @@ -186,12 +186,8 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level, // matrix by exchanging the two columns. static void interChangeDependencies(CharMatrix &DepMatrix, unsigned FromIndx, unsigned ToIndx) { - unsigned numRows = DepMatrix.size(); - for (unsigned i = 0; i < numRows; ++i) { - char TmpVal = DepMatrix[i][ToIndx]; - DepMatrix[i][ToIndx] = DepMatrix[i][FromIndx]; - DepMatrix[i][FromIndx] = TmpVal; - } + for (unsigned I = 0, E = DepMatrix.size(); I < E; ++I) + std::swap(DepMatrix[I][ToIndx], DepMatrix[I][FromIndx]); } // Checks if outermost non '=','S'or'I' dependence in the dependence matrix is |