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

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 4 15:16:22 PST 2020


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp:41
+  }
+  if (Unroll == PartiallyUnrolled) {
+    return;
----------------
Please elide braces.


================
Comment at: clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp:66
+    const auto *ParentStmt = Parent.get<AttributedStmt>();
+    if (!ParentStmt) {
+      continue;
----------------
Please elide braces.


================
Comment at: clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp:93
+  const Expr *Conditional = getCondExpr(Statement);
+  if (!Conditional) {
+    return false;
----------------
Please elide braces.


================
Comment at: clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp:130
+  const Expr *Conditional = getCondExpr(Statement);
+  if (!Conditional) {
+    return false;
----------------
Please elide braces.


================
Comment at: clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp:138
+    Expr::EvalResult result;
+    if (LHS->isEvaluatable(*Context) && !(RHS->isEvaluatable(*Context))) {
+      return exprHasLargeNumIterations(LHS, Context);
----------------
Please elide braces.


================
Comment at: clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp:141
+    }
+    if (RHS->isEvaluatable(*Context) && !(LHS->isEvaluatable(*Context))) {
+      return exprHasLargeNumIterations(RHS, Context);
----------------
Please elide braces.


================
Comment at: clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp:152
+  if (Expression->EvaluateAsRValue(Result, *Context)) {
+    if (!(Result.Val.isInt())) {
+      return false; // Cannot check number of iterations, return false to be
----------------
Please elide braces.


================
Comment at: clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp:156
+    }
+    if (Result.Val.getInt() > MaxLoopIterations) {
+      return true; // Assumes values go from 0 to Val in increments of 1.
----------------
Please elide braces.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:85
+
+  Finds inner loops that have not been unrolled, as well as fully unrolled
+  loops with unknown loops bounds or a large number of iterations.
----------------
Please synchronize with first statement in documentation.


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

https://reviews.llvm.org/D72235





More information about the cfe-commits mailing list