[PATCH] D99750: [LV, VP]VP intrinsics support for the Loop Vectorizer

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 06:55:22 PST 2023


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:986
+  auto *WideCanonicalIV =
+      cast<VPWidenCanonicalIVRecipe>(*FoundWidenCanonicalIVUser);
+  // Walk users of WideCanonicalIV and replace all compares of the form
----------------
fhahn wrote:
> ABataev wrote:
> > shiva0217 wrote:
> > > There is a case that VPWidenCanonicalIVRecipe didn't be generated with tail folding.
> > > 
> > >     int i;
> > >     int foo (int q, int z)
> > >     {
> > >       int e = 0;
> > >       while (z < 1)
> > >         {
> > >           q = z * 2;
> > >           if (q != 0)
> > >             for (i = 0; i < 2; ++i)
> > >               e = 5;
> > >           ++z;
> > >         }
> > >       return e;
> > >     }
> > > 
> > > `for (i = 0; i < 2; ++i)` been simplifed as `store i32 2, ptr @i`.
> > > Both pointer and store value are loop-invariant, so the mask(VPWidenCanonicalIVRecipe) might not be generated.
> > > Should we suppress the replacement when the mask is not available?
> > Fixed, added the test
> Was this fixed by adding the ` bool KeepVPCanonicalWidenRecipes` flag? What's the test case for this? There's a new `no_masking` case, but it has an empty body and no vector code is generated? 
> 
1. Yes.
2. Yes, this test is a reduced version of the failed case


================
Comment at: llvm/test/Transforms/LoopVectorize/RISCV/vectorize-vp-intrinsics.ll:5
+; RUN: -prefer-predicate-over-epilogue=predicate-dont-vectorize \
+; RUN: -mtriple=riscv64 -mattr=+v -S < %s 2>&1 | FileCheck --check-prefix=IF-EVL %s
+
----------------
fhahn wrote:
> no need to redirect stderr here?
Will drop


================
Comment at: llvm/test/Transforms/LoopVectorize/RISCV/vectorize-vp-intrinsics.ll:7
+
+; RUN: opt -passes=loop-vectorize \
+; RUN: -prefer-predicate-with-vp-intrinsics=force-explicit-vector-length-support \
----------------
fhahn wrote:
> Can this configuration be used for target-independent tests?
Not now, it relies on the check of the TTI interface for now


================
Comment at: llvm/test/Transforms/LoopVectorize/RISCV/vplan-vp-intrinsics.ll:3
+
+; RUN: opt -passes=loop-vectorize -debug-only=loop-vectorize \
+; RUN: -prefer-predicate-with-vp-intrinsics=if-explicit-vector-length-support \
----------------
fhahn wrote:
> Can this test be target independent? does it need to check the no VP case?
1. No
2. Yes, need to check that the option works correctly


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99750



More information about the llvm-commits mailing list