[PATCH] D67905: [LV] Vectorizer should adjust trip count in profile information

Daniil Suchkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 22:20:06 PST 2019


DaniilSuchkov accepted this revision.
DaniilSuchkov added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:3977
+// than original TC. At the same time original loop becomes prolog/epilog loop
+// and may not have more than VFxUF iterations.
+void InnerLoopVectorizer::fixProfileInfo() {
----------------
Nit: VFxUF - 1


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:3983-3985
+  if (OrigBackBranchI->extractProfMetadata(OrigTakenCount,
+                                           OrigFallThroughCount) &&
+      OrigFallThroughCount != 0) {
----------------
Style: it is usually advised to turn such conditions into early exits, it would reduce required indentation and slightly improve readability.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:4004
+    // Now calculate counters for prolog/epilog loop.
+    OrigTakenCount = (OrigIterCount % (VF * UF)) * OrigFallThroughCount;
+
----------------
Maybe introduce a new variable for this value (like EpilogueTakenCount)? Right now it's a bit surprising that Orig//Something// is being changed. Same goes to OrigFallThroughCount.


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

https://reviews.llvm.org/D67905





More information about the llvm-commits mailing list