[PATCH] D136587: use riscv vsetvl to tailfolding

Wang Pengcheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 02:34:03 PDT 2022


pcwang-thead added a comment.

You don't have to create a new differential, you could just upload your new patch in D136583 <https://reviews.llvm.org/D136583>. For now, let's discuss in this differential.

I have got what you want to do, but I think you can refer to Vector Predication <https://llvm.org/docs/Proposals/VectorPredication.html> and works in llvm-epi <https://repo.hca.bsc.es/gitlab/rferrer/llvm-epi>.



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:115
 #include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/IntrinsicsRISCV.h"
 #include "llvm/IR/Metadata.h"
----------------
It's target-dependent.
I would suggest that we add target hooks in TargetTransformInfo.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9813
+          if (MaskTy->isIntegerTy())
+            NewSI = Builder.CreateIntrinsic(Intrinsic::riscv_vse,
+                                            {StoredVal->getType(), MaskTy},
----------------
Ditto.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9850
+          NewLI = Builder.CreateIntrinsic(
+              Intrinsic::riscv_vle, {DataTy, MaskTy},
+              {PoisonValue::get(DataTy), VecPtr, Mask}, nullptr);
----------------
Ditto.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp:238
+    Instruction *Call = Builder.CreateIntrinsic(
+        Intrinsic::riscv_vsetvli, IntTy,
+        {AvLen, ConstantInt::get(IntTy, Log2_32(State.WidestTy / 8)),
----------------
Ditto.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136587



More information about the llvm-commits mailing list