[PATCH] D76838: [LV][LoopInfo] Transform counting-down loops to counting-up loop

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 08:47:22 PDT 2020


SjoerdMeijer added inline comments.


================
Comment at: llvm/include/llvm/Analysis/LoopInfo.h:580
   /// The IndVarSimplify pass transforms loops to have a canonical induction
   /// variable.
   ///
----------------
Ayal wrote:
> Following the above comment, this Analysis should rely on a previous Transformation to produce a canonical induction variable, if needed.
> 
> If this transformation is applied to a loop before deciding to vectorize it, there may be potential slowdowns when the loop remains unvectorized; so best handled independent of LV.
> 
> In terms of implementation, as far as LV is concerned, if getCanonicalInductionVariable() fails and one is to be constructed, do so by relying on  SCEV::getBackedgeTakenCount() instead of pattern matching.
> 
> Cf. http://lists.llvm.org/pipermail/llvm-dev/2020-March/140433.html
Sorry, but I just want to be sure, where does the transformation need to be implemented? Is that Indvar simplify, in SCEV, or a looputil function?

I may have also read a few things differently than I do know. For example, I thought I understood that it was undesired to do this in IndVarSimplify from the mail on the dev list. And also regarding that mail http://lists.llvm.org/pipermail/llvm-dev/2020-March/140433.html, and perhaps I should write this to the list, but I don't think I understand "As a consequence, any loop structure that is recognized by SCEV will (/should) not profit from rewriting."
 


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

https://reviews.llvm.org/D76838





More information about the llvm-commits mailing list