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

Simon Moll via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 07:48:14 PDT 2022


simoll created this revision.
simoll added reviewers: kaz7, rogfer01, craig.topper, frasercrmck.
simoll added a project: VP.
Herald added subscribers: dexonsmith, hiraditya.
Herald added a project: All.
simoll requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

VPIntrinsic::getStaticVectorLength infers the operational vector length of a VPIntrinsic instance from a type that is used with the intrinsic. The function used the mask operand before. Yet, vp.merge|select do not have a mask operand (in the predicating sense that the other VP intrinsics are using them - it is a selection mask for them). Fallback to the return type to fix this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121913

Files:
  llvm/lib/IR/IntrinsicInst.cpp


Index: llvm/lib/IR/IntrinsicInst.cpp
===================================================================
--- llvm/lib/IR/IntrinsicInst.cpp
+++ llvm/lib/IR/IntrinsicInst.cpp
@@ -299,7 +299,8 @@
   };
 
   Value *VPMask = getMaskParam();
-  assert(VPMask && "No mask param?");
+  if (!VPMask)
+    return GetVectorLengthOfType(getType());
   return GetVectorLengthOfType(VPMask->getType());
 }
 


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


More information about the llvm-commits mailing list