[PATCH] D121913: [VP] Fix VPintrinsic::getStaticVectorLength for vp.merge|select

Simon Moll via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 01:15:22 PDT 2022


simoll updated this revision to Diff 416837.
simoll marked an inline comment as done.
simoll added a comment.

Document that vp.merge, vp.select do not have a VP mask and why.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121913

Files:
  llvm/include/llvm/IR/VPIntrinsics.def
  llvm/lib/IR/IntrinsicInst.cpp


Index: llvm/lib/IR/IntrinsicInst.cpp
===================================================================
--- llvm/lib/IR/IntrinsicInst.cpp
+++ llvm/lib/IR/IntrinsicInst.cpp
@@ -299,7 +299,12 @@
   };
 
   Value *VPMask = getMaskParam();
-  assert(VPMask && "No mask param?");
+  if (!VPMask) {
+    assert((getIntrinsicID() == Intrinsic::vp_merge ||
+            getIntrinsicID() == Intrinsic::vp_select) &&
+           "Unexpected VP intrinsic without mask operand");
+    return GetVectorLengthOfType(getType());
+  }
   return GetVectorLengthOfType(VPMask->getType());
 }
 
Index: llvm/include/llvm/IR/VPIntrinsics.def
===================================================================
--- llvm/include/llvm/IR/VPIntrinsics.def
+++ llvm/include/llvm/IR/VPIntrinsics.def
@@ -397,6 +397,11 @@
 
 ///// Shuffles {
 
+// The mask 'cond' operand of llvm.vp.select and llvm.vp.merge are not reported
+// as masks with the BEGIN_REGISTER_VP_* macros.  This is because, unlike other
+// VP intrinsics, these two have a defined result on lanes where the mask is
+// false.
+//
 // llvm.vp.select(cond,on_true,on_false,vlen)
 BEGIN_REGISTER_VP(vp_select, None, 3, VP_SELECT, -1)
 VP_PROPERTY_FUNCTIONAL_OPC(Select)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121913.416837.patch
Type: text/x-patch
Size: 1209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220321/be90e0ac/attachment.bin>


More information about the llvm-commits mailing list