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

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 19:20:32 PST 2020


ebrevnov marked 2 inline comments as done.
ebrevnov added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:775
+      LLVMContext::MD_prof,
+      MDB.createBranchWeights(BackedgeTakenWeight, LatchExitWeight));
+
----------------
Ayal wrote:
> The last part could call fixupBranchWeights() if moved here from Transforms/Utils/LoopUnrollPeel.cpp
That would require to change implementation for fixupBranchWeights since it disregards to update when back edge taken count is zero.



================
Comment at: llvm/test/Transforms/LoopVectorize/tripcount.ll:211
+; CHECK: [[LP3]] = !{!"branch_weights", i32 10, i32 2490}
+; CHECK: [[LP6]] = !{!"branch_weights", i32 10, i32 0}
+
----------------
Ayal wrote:
> Following this, to clarify:
> original loop has latchExitWeight=10 and backedgeTakenWeight=10,000, therefore estimatedBackedgeTakenCount=1,000 and estimatedTripCount=1,001.
> Vectorizing by 4 produces
> estimatedTripCounts of 1,001/4=250 and 1,001%4=1 for vectorized and remainder loops, respectively, therefore their
> estimatedBackedgeTakenCounts are 249 and 0, and so the weights recorded with loop invocation weights of 10 are the above {10, 2490} and {10, 0}.
I will add this text to the test. I that what you wanted (just not sure :-))?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67905





More information about the llvm-commits mailing list