[llvm] [RISCV][LoopVectorize] Use DataWithEVL as the preferred tail folding style (PR #148686)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 11:04:46 PDT 2025


================
@@ -116,8 +116,7 @@ class RISCVTTIImpl final : public BasicTTIImplBase<RISCVTTIImpl> {
   }
   TailFoldingStyle
   getPreferredTailFoldingStyle(bool IVUpdateMayOverflow) const override {
-    return ST->hasVInstructions() ? TailFoldingStyle::Data
-                                  : TailFoldingStyle::DataWithoutLaneMask;
+    return TailFoldingStyle::DataWithEVL;
----------------
lukel97 wrote:

What would we return if RVV isn't enabled? DataWithoutLaneMask seems like it might be removed:

```c++
  /// Same as Data, but avoids using the get.active.lane.mask intrinsic to
  /// calculate the mask and instead implements this with a
  /// splat/stepvector/cmp.
  /// FIXME: Can this kind be removed now that SelectionDAGBuilder expands the
  /// active.lane.mask intrinsic when it is not natively supported?
  DataWithoutLaneMask,
```

It also looks like this only ever gets called when RVV is enabled, at least with `ninja check-llvm-transforms-loopvectorize`.  We could turn it into an assert instead?

https://github.com/llvm/llvm-project/pull/148686


More information about the llvm-commits mailing list