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

Taewook Oh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 4 22:10:24 PDT 2017


twoh added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:7683
+  unsigned ExpectedTC = SE->getSmallConstantMaxTripCount(L);
+  bool HasExpectedTC = (ExpectedTC > 0);
+
----------------
danielcdh wrote:
> 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.
I see. Yes, that totally makes sense, but I think the refactoring can be a separate patch once this one is checked in.


https://reviews.llvm.org/D32451





More information about the llvm-commits mailing list