diff options
author | Luke Lau <luke@igalia.com> | 2025-04-28 10:08:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-28 10:08:45 +0800 |
commit | 92c3af7c3e3163254cdd84b135ce87de9886be94 (patch) | |
tree | 3f1712d39d187df5effe460df587890d4d4ae362 | |
parent | 185ba025dadcefd7185f4d88bc94e5e75e010530 (diff) | |
download | llvm-92c3af7c3e3163254cdd84b135ce87de9886be94.zip llvm-92c3af7c3e3163254cdd84b135ce87de9886be94.tar.gz llvm-92c3af7c3e3163254cdd84b135ce87de9886be94.tar.bz2 |
[VPlan] Use correct constructor when cloning VPWidenIntrinsicRecipe without underlying CallInst (#137493)
I noticed this when working on a patch downstream, and I don't think
this is an issue upstream yet.
But if a VPWidenIntrinsicRecipe is created without an underlying
CallInst, e.g. in createEVLRecipe, it will crash if you try to clone it
because it assumes the CallInst always exists.
This fixes it by using the CallInst-less constructor in this case.
-rw-r--r-- | llvm/lib/Transforms/Vectorize/VPlan.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h index 2826a1a..147ca5b 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -1351,8 +1351,11 @@ public: ~VPWidenIntrinsicRecipe() override = default; VPWidenIntrinsicRecipe *clone() override { - return new VPWidenIntrinsicRecipe(*cast<CallInst>(getUnderlyingValue()), - VectorIntrinsicID, {op_begin(), op_end()}, + if (Value *CI = getUnderlyingValue()) + return new VPWidenIntrinsicRecipe(*cast<CallInst>(CI), VectorIntrinsicID, + {op_begin(), op_end()}, ResultTy, + getDebugLoc()); + return new VPWidenIntrinsicRecipe(VectorIntrinsicID, {op_begin(), op_end()}, ResultTy, getDebugLoc()); } |