[PATCH] D32451: Improve profile-guided heuristics to use estimated trip count.

Dehao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 13:13:11 PDT 2017


danielcdh added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:7683
+  unsigned ExpectedTC = SE->getSmallConstantMaxTripCount(L);
+  bool HasExpectedTC = (ExpectedTC > 0);
+
----------------
twoh wrote:
> danielcdh wrote:
> > Can this code be refactor with the loop unroller to make something like "isFlatLoop"?
> I'm afraid I couldn't understand your suggestion. Can you please provide a little bit more of details?
My point is, loop unroller and loop vectorizer should have the same logic: if the loop TC is small, it should not be unrolled/vectorized. My suggestion is, if the logic is the same, we'd better refactor it out so that we are consistent making unroll/vectorize decisions.

Of cause, the logic to check TinyTripCountVectorThreshold was not introduced in this patch. But with your change, the profile is used, making it very close to the logic used in loop unroller. So I suggest refactoring them out to a utility function.


https://reviews.llvm.org/D32451





More information about the llvm-commits mailing list