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

Simon Moll via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 03:42:49 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7de383c89213: [VP] Fix VPintrinsic::getStaticVectorLength for vp.merge|select (authored by simoll).

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.417236.patch
Type: text/x-patch
Size: 1209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220322/29cca896/attachment.bin>


More information about the llvm-commits mailing list