[PATCH] D65197: [LV] Tail-loop Folding

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 03:19:51 PDT 2019


sdesmalen added a comment.

For SVE we found that there are sometimes benefits to using an unpredicated vector body plus a predicated tail. When the main vectorized loop-body is unpredicated, we know all lanes in the vector are executed and can produce more efficient set of instructions. The scalar tail can then still be vectorized using predication to mask off the inactive lanes, or depending on the cost of vectorizing the tail loop the compiler may want to choose not vectorizing the tail loop at all. It would be nice if your design allows for this use-case. 
So maybe instead of having a boolean 'llvm.loop.vectorize.predicate.enable' you can make it into an enum, or perhaps rename the attribute to emphasises the difference so we can add this logic later?



================
Comment at: llvm/lib/Analysis/LoopInfo.cpp:516
+
+    if (Name.equals(S->getString()) &&
+        mdconst::extract<ConstantInt>(MD->getOperand(1))->getZExtValue())
----------------
nit:
```
return Name.equals(S->getString()) &&
       mdconst::extract<ConstantInt>(MD->getOperand(1))->getZExtValue());
```


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7344
   ScalarEpilogueLowering SEL = CM_ScalarEpilogueAllowed;
+
   if (Hints.getForce() != LoopVectorizeHints::FK_Enabled &&
----------------
nit: unnecessary whitespace.


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

https://reviews.llvm.org/D65197





More information about the llvm-commits mailing list