[PATCH] D116875: [clang-tidy] Add performance-inefficient-array-traversal check

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 9 01:29:51 PST 2022


njames93 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/performance/InefficientArrayTraversalCheck.cpp:63
+                                        hasLHS(ToDecl),
+                                        hasRHS(integerLiteral(equals(1)))))),
+                     hasBody(BodyMatcher))
----------------
Thoughts on this, prefetchers are often able to detect strided access so is forcing increment to be `1` removing potential functionality.


================
Comment at: clang-tools-extra/clang-tidy/performance/InefficientArrayTraversalCheck.cpp:91
+  diag(Array->getBeginLoc(),
+       "Nonsequential array traversal can harm performance");
+  diag(InnerLoopStmt->getBeginLoc(), "Row index %0 incremented in this loop",
----------------
Any ideas on a nicer way to say this? I feel like this message isn't as descriptive as I'd like, and non-native English speakers could struggle to understand it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116875



More information about the cfe-commits mailing list