diff options
author | Simon Moll <simon.moll@emea.nec.com> | 2022-03-22 11:41:14 +0100 |
---|---|---|
committer | Simon Moll <simon.moll@emea.nec.com> | 2022-03-22 11:41:23 +0100 |
commit | 7de383c892135ac7ecb67460c677aed72efdb76a (patch) | |
tree | d9b1f92eab3092fa3081e676d32072cbcd4d4079 /llvm/lib/IR/IntrinsicInst.cpp | |
parent | 51ba13b1aea3d6e04310b80b6bcfc641049b9890 (diff) | |
download | llvm-7de383c892135ac7ecb67460c677aed72efdb76a.zip llvm-7de383c892135ac7ecb67460c677aed72efdb76a.tar.gz llvm-7de383c892135ac7ecb67460c677aed72efdb76a.tar.bz2 |
[VP] Fix VPintrinsic::getStaticVectorLength for vp.merge|select
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.
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D121913
Diffstat (limited to 'llvm/lib/IR/IntrinsicInst.cpp')
-rw-r--r-- | llvm/lib/IR/IntrinsicInst.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp index 4850e30..ad729b0 100644 --- a/llvm/lib/IR/IntrinsicInst.cpp +++ b/llvm/lib/IR/IntrinsicInst.cpp @@ -299,7 +299,12 @@ ElementCount VPIntrinsic::getStaticVectorLength() const { }; 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()); } |