[llvm] [LV][EVL] Support call instruction with EVL-vectorization (PR #110412)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 23:57:37 PDT 2024


================
@@ -1023,6 +1038,18 @@ InstructionCost VPWidenIntrinsicRecipe::computeCost(ElementCount VF,
   // clear Arguments.
   // TODO: Rework TTI interface to be independent of concrete IR values.
   SmallVector<const Value *> Arguments;
+
+  Intrinsic::ID FID = VectorIntrinsicID;
+  unsigned NumOperands = getNumOperands();
+  if (VPIntrinsic::isVPIntrinsic(VectorIntrinsicID)) {
+    std::optional<Intrinsic::ID> ID =
+        VPIntrinsic::getFunctionalIntrinsicIDForVP(VectorIntrinsicID);
+    if (ID) {
+      FID = ID.value();
----------------
LiqinWeng wrote:

I tried but failed. The main problems I found were: 
1. We have no way to obtain VP Inst. Some VPs need Inst information when calculating costs,such as vp_icmp/vp_fcmp. 
![image](https://github.com/user-attachments/assets/ef7997e5-b02f-452a-a0d3-785495e9f9cd)
2. The size of Arguments is wrong, it will be cleared. I tried adding a mask (nullptr or get from `getBlockInMask`). I think VP's cost  doesn't care about masks,so I didn't do it.
![image](https://github.com/user-attachments/assets/765d315d-2069-431c-a1ef-18dc041aefad)
3.  I think VP Intrinsics should have the same cost as their non-vp counterpart. 
I am not sure about some of the questions. If there are any problems, please point them out.

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


More information about the llvm-commits mailing list