[PATCH] D72235: [clang-tidy] new altera unroll loops check

Frank Derry Wanye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 5 10:54:13 PST 2021


ffrankies updated this revision to Diff 328579.
ffrankies marked 12 inline comments as done.
ffrankies added a comment.

- Added support for `CXXForRangeStmt` loops
- Added support for different for loop increments (`++`, `--`, `+=`, `-=`, `*=`, `\=`)
  - Depending on the exit condition, the calculations for the number of Iterations may be off by 1, but that should not be an issue performance-wise since the threshold for a "large" number of iterations is likely to be arbitrary.
  - If any other increment is used in the increment part of the `for` loop, we recommend partial unrolling.
- Changed the way `while` and `do..while` loops are handled: because the loop variable is changed within the loop body and it is untrivial to determine what is happening to it, we now emit a Note diagnostic (instead of warning) recommending partial unrolling if a `while` or `do..while` loop is fully unrolled.
- Added tests for the above
- Documented the above caveats in `clang-tools-extra/docs/clang-tidy/checks/altera-unroll-loops.rst`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72235/new/

https://reviews.llvm.org/D72235

Files:
  clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp
  clang-tools-extra/clang-tidy/altera/CMakeLists.txt
  clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp
  clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/altera-unroll-loops.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/test/clang-tidy/checkers/altera-unroll-loops.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72235.328579.patch
Type: text/x-patch
Size: 38753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210305/ee97cb24/attachment.bin>


More information about the llvm-commits mailing list