[PATCH] D67905: [LV] Vectorizer should adjust trip count in profile information
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 16:03:28 PST 2020
Ayal accepted this revision.
Ayal added a comment.
This looks good to me, thanks!
================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:775
+ LLVMContext::MD_prof,
+ MDB.createBranchWeights(BackedgeTakenWeight, LatchExitWeight));
+
----------------
The last part could call fixupBranchWeights() if moved here from Transforms/Utils/LoopUnrollPeel.cpp
================
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}
+
----------------
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}.
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